@aiquants/resize-panels 1.6.0 → 1.7.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.
- package/README.md +2 -2
- package/dist/Panel.d.ts.map +1 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1068 -1047
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import { createContext as vt, useContext as Mt, useCallback as
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { twMerge as
|
|
1
|
+
import { createContext as vt, useContext as Mt, useCallback as Se, useMemo as ae, useReducer as wt, useState as Me, useRef as J, useEffect as se, useLayoutEffect as Xe, memo as it, useId as zt, useSyncExternalStore as ht } from "react";
|
|
2
|
+
import { jsx as I, jsxs as fe } from "react/jsx-runtime";
|
|
3
|
+
import { twMerge as $e } from "tailwind-merge";
|
|
4
4
|
import { createPortal as Et } from "react-dom";
|
|
5
|
-
const
|
|
6
|
-
const t = Mt(
|
|
5
|
+
const gt = vt(null), rt = () => {
|
|
6
|
+
const t = Mt(gt);
|
|
7
7
|
if (!t)
|
|
8
8
|
throw new Error("usePanelGroup must be used within a PanelGroup");
|
|
9
9
|
return t;
|
|
10
|
-
},
|
|
10
|
+
}, xt = (t, e = 0) => {
|
|
11
11
|
if (!Number.isFinite(t))
|
|
12
12
|
return t;
|
|
13
|
-
const n = 10 ** e, d = t * n, r = Math.floor(d),
|
|
14
|
-
return
|
|
15
|
-
},
|
|
13
|
+
const n = 10 ** e, d = t * n, r = Math.floor(d), c = d - r, i = Number.EPSILON * Math.max(1, Math.abs(d));
|
|
14
|
+
return c < 0.5 - i ? r / n : c > 0.5 + i ? (r + 1) / n : (r % 2 === 0 ? r : r + 1) / n;
|
|
15
|
+
}, St = 12, nt = 8, Bt = 8, Rt = 8, mt = 0.05, Pt = 10, It = 0.05, Ft = 20, Nt = 0.05, ot = 0, bt = 6, Ce = (t, e) => e <= 0 ? 0 : xt(t / e * 100, bt), We = (t, e) => !t || e <= 0 ? 0 : t / 100 * e, Qe = (t, e = "percentage") => {
|
|
16
16
|
if (t !== void 0)
|
|
17
17
|
return typeof t == "number" ? { value: t, unit: e } : t;
|
|
18
|
-
},
|
|
18
|
+
}, st = (t, e) => t ? t.unit === "percentage" ? t.value / 100 * e : t.value : 0, te = (t, e, n) => t ? typeof t == "number" ? t / 100 * n : t.unit === "pixels" ? t.value : t.value / 100 * n : e, me = (t, e, n) => Math.min(Math.max(t, e), n), et = (t) => {
|
|
19
19
|
if (!Number.isFinite(t) || t <= 0)
|
|
20
|
-
return
|
|
21
|
-
const e = t *
|
|
22
|
-
return Math.max(
|
|
23
|
-
},
|
|
20
|
+
return ot;
|
|
21
|
+
const e = t * mt, n = Math.min(St, Pt, e);
|
|
22
|
+
return Math.max(ot, n);
|
|
23
|
+
}, Ct = (t, e, n, d = {}) => {
|
|
24
24
|
if (Math.abs(e) <= 0)
|
|
25
25
|
return e;
|
|
26
|
-
const r = d.enforceAutoMinSize ?? !1,
|
|
27
|
-
if (
|
|
26
|
+
const r = d.enforceAutoMinSize ?? !1, c = t.map((s, a) => ({ panel: s, index: a })).filter(({ panel: s }) => !s.collapsed && (s.sizeUnit === "pixels" || s.originalPixelSize !== void 0));
|
|
27
|
+
if (c.length === 0)
|
|
28
28
|
return e;
|
|
29
|
-
const i = e > 0,
|
|
30
|
-
const o = s.panel.pixelAdjustPriority ?? s.index + 1,
|
|
31
|
-
return o ===
|
|
29
|
+
const i = e > 0, p = [...c].sort((s, a) => {
|
|
30
|
+
const o = s.panel.pixelAdjustPriority ?? s.index + 1, h = a.panel.pixelAdjustPriority ?? a.index + 1;
|
|
31
|
+
return o === h ? i ? a.index - s.index : s.index - a.index : i ? h - o : o - h;
|
|
32
32
|
});
|
|
33
33
|
let u = e;
|
|
34
34
|
const z = (s) => {
|
|
35
|
-
for (const { index: a } of
|
|
35
|
+
for (const { index: a } of p) {
|
|
36
36
|
if (Math.abs(u) <= 0)
|
|
37
37
|
break;
|
|
38
38
|
const o = t[a];
|
|
39
39
|
if (!o || o.collapsed)
|
|
40
40
|
continue;
|
|
41
|
-
const
|
|
41
|
+
const h = Qe(o.minSize, "pixels"), b = Qe(o.maxSize, "pixels"), m = h ? st(h, n) : 0, v = b ? st(b, n) : n, x = r ? te(o.autoMinSize, 0, n) : 0, C = Math.max(m, x), S = o.preferredPixelSize !== void 0 ? me(o.preferredPixelSize, C, v) : o.size, D = o.collapseFromStart || o.collapseFromEnd;
|
|
42
42
|
if (u > 0) {
|
|
43
43
|
if (Math.abs(o.size) <= 0 && (o.percentageSize ?? 0) <= 0)
|
|
44
44
|
continue;
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
45
|
+
const re = Math.max(o.size, S), de = s ? Math.min(v, re) : v, j = Math.max(0, de - o.size);
|
|
46
|
+
if (j <= 0)
|
|
47
47
|
continue;
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
48
|
+
const _ = Math.min(j, u);
|
|
49
|
+
if (_ <= 0)
|
|
50
50
|
continue;
|
|
51
|
-
const
|
|
51
|
+
const E = o.size + _, oe = Ce(E, n), U = D ? E : o.sizeBeforeCollapse, V = D ? o.measuredPixelSizeBeforeCollapse ?? o.measuredPixelSize ?? E : o.measuredPixelSizeBeforeCollapse;
|
|
52
52
|
t[a] = {
|
|
53
53
|
...o,
|
|
54
|
-
size:
|
|
55
|
-
percentageSize:
|
|
56
|
-
sizeBeforeCollapse:
|
|
57
|
-
measuredPixelSizeBeforeCollapse:
|
|
54
|
+
size: E,
|
|
55
|
+
percentageSize: oe,
|
|
56
|
+
sizeBeforeCollapse: U,
|
|
57
|
+
measuredPixelSizeBeforeCollapse: V,
|
|
58
58
|
measuredPixelSize: void 0,
|
|
59
59
|
measuredPercentageSize: void 0
|
|
60
|
-
}, u -=
|
|
60
|
+
}, u -= _;
|
|
61
61
|
} else {
|
|
62
|
-
const X = s ?
|
|
63
|
-
if (
|
|
62
|
+
const X = s ? S : C, re = Math.max(0, o.size - X);
|
|
63
|
+
if (re <= 0)
|
|
64
64
|
continue;
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
65
|
+
const de = Math.min(re, Math.abs(u));
|
|
66
|
+
if (de <= 0)
|
|
67
67
|
continue;
|
|
68
|
-
const
|
|
68
|
+
const j = o.size - de, _ = Ce(j, n), E = D ? j : o.sizeBeforeCollapse, oe = D ? o.measuredPixelSizeBeforeCollapse ?? o.measuredPixelSize ?? j : o.measuredPixelSizeBeforeCollapse;
|
|
69
69
|
t[a] = {
|
|
70
70
|
...o,
|
|
71
|
-
size:
|
|
72
|
-
percentageSize:
|
|
73
|
-
sizeBeforeCollapse:
|
|
74
|
-
measuredPixelSizeBeforeCollapse:
|
|
71
|
+
size: j,
|
|
72
|
+
percentageSize: _,
|
|
73
|
+
sizeBeforeCollapse: E,
|
|
74
|
+
measuredPixelSizeBeforeCollapse: oe,
|
|
75
75
|
measuredPixelSize: void 0,
|
|
76
76
|
measuredPercentageSize: void 0
|
|
77
|
-
}, u +=
|
|
77
|
+
}, u += de;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
81
|
return z(!0), (i && u > 0 || !i && u < 0) && z(!1), u;
|
|
82
|
-
},
|
|
82
|
+
}, Ve = (t) => {
|
|
83
83
|
if (!t)
|
|
84
84
|
return 0;
|
|
85
85
|
const e = parseFloat(t);
|
|
86
86
|
return Number.isFinite(e) ? e : 0;
|
|
87
|
-
},
|
|
88
|
-
const n = t.getBoundingClientRect(), d = typeof window < "u" ? window.getComputedStyle(t) : null, r = d ?
|
|
87
|
+
}, Oe = (t, e) => {
|
|
88
|
+
const n = t.getBoundingClientRect(), d = typeof window < "u" ? window.getComputedStyle(t) : null, r = d ? Ve(d.borderLeftWidth) + Ve(d.borderRightWidth) : 0, c = d ? Ve(d.borderTopWidth) + Ve(d.borderBottomWidth) : 0;
|
|
89
89
|
if (e === "horizontal") {
|
|
90
90
|
const z = n.width > 0 ? n.width : t.offsetWidth, s = n.width > 0 ? Math.max(0, n.width - r) : t.clientWidth, a = t.offsetWidth > 0 ? t.offsetWidth : t.clientWidth + r;
|
|
91
91
|
return {
|
|
@@ -93,9 +93,9 @@ const pt = vt(null), Qe = () => {
|
|
|
93
93
|
outer: z > 0 ? z : Math.max(0, a)
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
const i = n.height > 0 ? n.height : t.offsetHeight,
|
|
96
|
+
const i = n.height > 0 ? n.height : t.offsetHeight, p = n.height > 0 ? Math.max(0, n.height - c) : t.clientHeight, u = t.offsetHeight > 0 ? t.offsetHeight : t.clientHeight + c;
|
|
97
97
|
return {
|
|
98
|
-
inner:
|
|
98
|
+
inner: p > 0 ? p : Math.max(0, t.clientHeight),
|
|
99
99
|
outer: i > 0 ? i : Math.max(0, u)
|
|
100
100
|
};
|
|
101
101
|
}, At = (t, e) => {
|
|
@@ -112,8 +112,8 @@ const pt = vt(null), Qe = () => {
|
|
|
112
112
|
return console.warn("Failed to load panel layout:", e), null;
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
|
-
var
|
|
116
|
-
const
|
|
115
|
+
var qe = /* @__PURE__ */ ((t) => (t[t.DEBUG = 0] = "DEBUG", t[t.INFO = 1] = "INFO", t[t.WARN = 2] = "WARN", t[t.ERROR = 3] = "ERROR", t[t.NONE = 4] = "NONE", t))(qe || {});
|
|
116
|
+
const Ee = class Ee {
|
|
117
117
|
/**
|
|
118
118
|
* @constructor
|
|
119
119
|
* @param {LogLevel} [level=LogLevel.WARN] - The minimum log level to output.
|
|
@@ -130,7 +130,7 @@ const we = class we {
|
|
|
130
130
|
* @param {LogLevel} level - The new log level.
|
|
131
131
|
*/
|
|
132
132
|
static setLevel(e) {
|
|
133
|
-
|
|
133
|
+
Ee.instance.setLevel(e);
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* @method setLevel
|
|
@@ -148,7 +148,7 @@ const we = class we {
|
|
|
148
148
|
* @param {ILogger} impl - The new logger implementation.
|
|
149
149
|
*/
|
|
150
150
|
static setImplementation(e) {
|
|
151
|
-
|
|
151
|
+
Ee.instance.setImplementation(e);
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
154
|
* @method setImplementation
|
|
@@ -166,7 +166,7 @@ const we = class we {
|
|
|
166
166
|
* @param {string} prefix - The new prefix.
|
|
167
167
|
*/
|
|
168
168
|
static setPrefix(e) {
|
|
169
|
-
|
|
169
|
+
Ee.instance.setPrefix(e);
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
172
172
|
* @method setPrefix
|
|
@@ -181,33 +181,33 @@ const we = class we {
|
|
|
181
181
|
return typeof e == "string" ? [`${this.prefix} ${e}`] : [this.prefix, e];
|
|
182
182
|
}
|
|
183
183
|
static debug(e, ...n) {
|
|
184
|
-
|
|
184
|
+
Ee.instance.debug(e, ...n);
|
|
185
185
|
}
|
|
186
186
|
debug(e, ...n) {
|
|
187
187
|
this.level <= 0 && this.impl.debug(...this.formatMessage(e), ...n);
|
|
188
188
|
}
|
|
189
189
|
static info(e, ...n) {
|
|
190
|
-
|
|
190
|
+
Ee.instance.info(e, ...n);
|
|
191
191
|
}
|
|
192
192
|
info(e, ...n) {
|
|
193
193
|
this.level <= 1 && this.impl.info(...this.formatMessage(e), ...n);
|
|
194
194
|
}
|
|
195
195
|
static warn(e, ...n) {
|
|
196
|
-
|
|
196
|
+
Ee.instance.warn(e, ...n);
|
|
197
197
|
}
|
|
198
198
|
warn(e, ...n) {
|
|
199
199
|
this.level <= 2 && this.impl.warn(...this.formatMessage(e), ...n);
|
|
200
200
|
}
|
|
201
201
|
static error(e, ...n) {
|
|
202
|
-
|
|
202
|
+
Ee.instance.error(e, ...n);
|
|
203
203
|
}
|
|
204
204
|
error(e, ...n) {
|
|
205
205
|
this.level <= 3 && this.impl.error(...this.formatMessage(e), ...n);
|
|
206
206
|
}
|
|
207
207
|
};
|
|
208
|
-
|
|
209
|
-
let
|
|
210
|
-
const
|
|
208
|
+
Ee.instance = new Ee(2, "[resize-panels]");
|
|
209
|
+
let je = Ee;
|
|
210
|
+
const ze = new je(qe.INFO, "[resize-panels]"), ve = (t) => t.map((e) => ({
|
|
211
211
|
id: e.id,
|
|
212
212
|
size: e.size,
|
|
213
213
|
percentageSize: e.percentageSize,
|
|
@@ -221,7 +221,7 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
221
221
|
collapseFromStart: e.collapseFromStart,
|
|
222
222
|
collapseFromEnd: e.collapseFromEnd,
|
|
223
223
|
collapsedByDirection: e.collapsedByDirection ?? null
|
|
224
|
-
})),
|
|
224
|
+
})), Ye = (t) => t ? ve([t])[0] : null, De = (t) => t ? !!(t.collapseFromStart || t.collapseFromEnd) : !1, Ke = (t, e) => {
|
|
225
225
|
if (!Number.isFinite(e) || e <= 0)
|
|
226
226
|
return t;
|
|
227
227
|
const n = t.map((u) => ({ ...u })), d = [];
|
|
@@ -235,35 +235,35 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
235
235
|
};
|
|
236
236
|
continue;
|
|
237
237
|
}
|
|
238
|
-
const s = Math.max(0,
|
|
239
|
-
let
|
|
238
|
+
const s = Math.max(0, te(z.minSize, 0, e)), a = Math.max(0, te(z.autoMinSize, 0, e)), o = Math.max(s, a), h = Math.max(1e-3, o), b = te(z.maxSize, e, e), m = Math.max(o, b), v = z.sizeUnit === "pixels" || z.originalPixelSize !== void 0, x = Math.max(0, z.size);
|
|
239
|
+
let C = o;
|
|
240
240
|
if (v) {
|
|
241
241
|
const D = z.preferredPixelSize ?? z.size ?? z.originalPixelSize ?? o;
|
|
242
|
-
|
|
242
|
+
C = me(D, o, m);
|
|
243
243
|
} else {
|
|
244
|
-
const D = z.preferredPercentageSize ?? z.percentageSize ??
|
|
245
|
-
|
|
244
|
+
const D = z.preferredPercentageSize ?? z.percentageSize ?? Ce(z.size, e), X = We(D, e);
|
|
245
|
+
C = me(X, o, m);
|
|
246
246
|
}
|
|
247
|
-
const
|
|
247
|
+
const S = !v && (z.excludeFromAutoGrowth ?? !1) && x <= h;
|
|
248
248
|
d.push({
|
|
249
249
|
index: u,
|
|
250
250
|
isPixelPanel: v,
|
|
251
251
|
minSize: o,
|
|
252
|
-
maxSize:
|
|
253
|
-
preferredSize:
|
|
252
|
+
maxSize: m,
|
|
253
|
+
preferredSize: C,
|
|
254
254
|
priority: z.pixelAdjustPriority ?? u + 1,
|
|
255
255
|
flexPriority: v ? void 0 : z.flexAdjustPriority,
|
|
256
|
-
excludeFromGrowth:
|
|
256
|
+
excludeFromGrowth: S
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
259
|
if (d.length === 0)
|
|
260
260
|
return n;
|
|
261
261
|
const r = /* @__PURE__ */ new Map();
|
|
262
|
-
let
|
|
262
|
+
let c = 0;
|
|
263
263
|
for (const u of d)
|
|
264
|
-
r.set(u.index, u.minSize),
|
|
265
|
-
let i = e -
|
|
266
|
-
const
|
|
264
|
+
r.set(u.index, u.minSize), c += u.minSize;
|
|
265
|
+
let i = e - c;
|
|
266
|
+
const p = (u, z) => {
|
|
267
267
|
if (z <= 0)
|
|
268
268
|
return 0;
|
|
269
269
|
const s = r.get(u.index) ?? u.minSize, a = Math.max(0, u.maxSize - s);
|
|
@@ -276,29 +276,29 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
276
276
|
const u = (s) => {
|
|
277
277
|
for (; i > 1e-6; ) {
|
|
278
278
|
let o = 0;
|
|
279
|
-
const
|
|
279
|
+
const h = [];
|
|
280
280
|
for (const v of s) {
|
|
281
281
|
if (!v.isPixelPanel && v.excludeFromGrowth)
|
|
282
282
|
continue;
|
|
283
|
-
const
|
|
284
|
-
|
|
283
|
+
const x = r.get(v.index) ?? v.minSize, C = Math.min(v.preferredSize, v.maxSize), S = Math.max(0, C - x);
|
|
284
|
+
S > 1e-6 && (o += S, h.push({ descriptor: v, capacity: S }));
|
|
285
285
|
}
|
|
286
|
-
if (
|
|
286
|
+
if (h.length === 0 || o <= 1e-6)
|
|
287
287
|
break;
|
|
288
|
-
let
|
|
289
|
-
const
|
|
290
|
-
for (const v of
|
|
288
|
+
let b = 0;
|
|
289
|
+
const m = i;
|
|
290
|
+
for (const v of h) {
|
|
291
291
|
if (i <= 1e-6)
|
|
292
292
|
break;
|
|
293
293
|
if (!v.descriptor.isPixelPanel && v.descriptor.excludeFromGrowth)
|
|
294
294
|
continue;
|
|
295
|
-
const
|
|
296
|
-
if (
|
|
295
|
+
const x = m * v.capacity / o, C = Math.min(v.capacity, x);
|
|
296
|
+
if (C <= 0)
|
|
297
297
|
continue;
|
|
298
|
-
const
|
|
299
|
-
|
|
298
|
+
const S = p(v.descriptor, C);
|
|
299
|
+
S > 0 && (i -= S, b += S);
|
|
300
300
|
}
|
|
301
|
-
if (
|
|
301
|
+
if (b <= 1e-6)
|
|
302
302
|
break;
|
|
303
303
|
}
|
|
304
304
|
}, z = d.filter((s) => s.isPixelPanel);
|
|
@@ -306,32 +306,32 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
306
306
|
for (const s of z) {
|
|
307
307
|
if (i <= 0)
|
|
308
308
|
break;
|
|
309
|
-
const a = r.get(s.index) ?? s.minSize, o = Math.min(s.preferredSize, s.maxSize),
|
|
310
|
-
if (
|
|
309
|
+
const a = r.get(s.index) ?? s.minSize, o = Math.min(s.preferredSize, s.maxSize), h = Math.max(0, o - a);
|
|
310
|
+
if (h <= 0)
|
|
311
311
|
continue;
|
|
312
|
-
const
|
|
313
|
-
|
|
312
|
+
const b = p(s, Math.min(h, i));
|
|
313
|
+
b > 0 && (i -= b);
|
|
314
314
|
}
|
|
315
315
|
if (i > 0) {
|
|
316
316
|
const s = d.filter((a) => !a.isPixelPanel);
|
|
317
317
|
if (s.length > 0) {
|
|
318
318
|
const a = s.filter((o) => o.flexPriority !== void 0 && !o.excludeFromGrowth);
|
|
319
319
|
if (a.length > 0) {
|
|
320
|
-
a.sort((o,
|
|
320
|
+
a.sort((o, h) => (h.flexPriority ?? 0) - (o.flexPriority ?? 0));
|
|
321
321
|
for (const o of a) {
|
|
322
322
|
if (i <= 0)
|
|
323
323
|
break;
|
|
324
324
|
if (o.excludeFromGrowth)
|
|
325
325
|
continue;
|
|
326
|
-
const
|
|
327
|
-
if (
|
|
326
|
+
const h = r.get(o.index) ?? o.minSize, b = Math.min(o.preferredSize, o.maxSize), m = Math.max(0, b - h);
|
|
327
|
+
if (m <= 0)
|
|
328
328
|
continue;
|
|
329
|
-
const v =
|
|
329
|
+
const v = p(o, Math.min(m, i));
|
|
330
330
|
v > 0 && (i -= v);
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
if (i > 0) {
|
|
334
|
-
const o = a.length > 0 ? s.filter((
|
|
334
|
+
const o = a.length > 0 ? s.filter((h) => h.flexPriority === void 0 && !h.excludeFromGrowth) : s.filter((h) => !h.excludeFromGrowth);
|
|
335
335
|
o.length > 0 && u(o);
|
|
336
336
|
}
|
|
337
337
|
}
|
|
@@ -345,8 +345,8 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
345
345
|
for (const o of d) {
|
|
346
346
|
if (!o.isPixelPanel && o.excludeFromGrowth)
|
|
347
347
|
continue;
|
|
348
|
-
const
|
|
349
|
-
|
|
348
|
+
const h = r.get(o.index) ?? o.minSize, b = o.isPixelPanel ? Math.min(o.maxSize, o.preferredSize) : o.maxSize, m = Math.max(0, b - h);
|
|
349
|
+
m > 0 && (s.push(o), z += m);
|
|
350
350
|
}
|
|
351
351
|
if (z <= 0)
|
|
352
352
|
break;
|
|
@@ -356,11 +356,11 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
356
356
|
break;
|
|
357
357
|
if (!o.isPixelPanel && o.excludeFromGrowth)
|
|
358
358
|
continue;
|
|
359
|
-
const
|
|
360
|
-
if (
|
|
359
|
+
const h = r.get(o.index) ?? o.minSize, b = o.isPixelPanel ? Math.min(o.maxSize, o.preferredSize) : o.maxSize, m = Math.max(0, b - h);
|
|
360
|
+
if (m <= 0)
|
|
361
361
|
continue;
|
|
362
|
-
const v = a *
|
|
363
|
-
|
|
362
|
+
const v = a * m / z, x = p(o, Math.min(m, v));
|
|
363
|
+
x > 0 && (i -= x);
|
|
364
364
|
}
|
|
365
365
|
if (i <= 1e-6 || Math.abs(u - i) <= 1e-6)
|
|
366
366
|
break;
|
|
@@ -376,15 +376,15 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
376
376
|
for (const a of z) {
|
|
377
377
|
if (i >= 0)
|
|
378
378
|
break;
|
|
379
|
-
const o = r.get(a.index) ?? a.minSize,
|
|
380
|
-
if (
|
|
381
|
-
const v = Math.min(
|
|
379
|
+
const o = r.get(a.index) ?? a.minSize, h = me(a.preferredSize, a.minSize, a.maxSize), b = Math.max(0, o - h);
|
|
380
|
+
if (b > 0 && i < 0) {
|
|
381
|
+
const v = Math.min(b, Math.abs(i));
|
|
382
382
|
r.set(a.index, o - v), i += v, s = !0;
|
|
383
383
|
continue;
|
|
384
384
|
}
|
|
385
|
-
const
|
|
386
|
-
if (
|
|
387
|
-
const v = Math.min(
|
|
385
|
+
const m = Math.max(0, o - a.minSize);
|
|
386
|
+
if (m > 0 && i < 0) {
|
|
387
|
+
const v = Math.min(m, Math.abs(i));
|
|
388
388
|
r.set(a.index, o - v), i += v, s = !0;
|
|
389
389
|
}
|
|
390
390
|
}
|
|
@@ -394,27 +394,27 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
for (const u of d) {
|
|
397
|
-
const z = r.get(u.index) ?? u.minSize, s = n[u.index], a =
|
|
397
|
+
const z = r.get(u.index) ?? u.minSize, s = n[u.index], a = De(s), o = a ? z : s.sizeBeforeCollapse, h = a ? s.measuredPixelSizeBeforeCollapse ?? s.measuredPixelSize ?? z : s.measuredPixelSizeBeforeCollapse, b = e > 0 ? Ce(z, e) : 0;
|
|
398
398
|
n[u.index] = {
|
|
399
399
|
...s,
|
|
400
400
|
size: z,
|
|
401
|
-
percentageSize:
|
|
401
|
+
percentageSize: b,
|
|
402
402
|
preferredPercentageSize: s.preferredPercentageSize,
|
|
403
403
|
preferredPixelSize: u.isPixelPanel ? s.preferredPixelSize ?? z : s.preferredPixelSize,
|
|
404
404
|
sizeBeforeCollapse: o,
|
|
405
|
-
measuredPixelSizeBeforeCollapse:
|
|
405
|
+
measuredPixelSizeBeforeCollapse: h,
|
|
406
406
|
measuredPixelSize: void 0,
|
|
407
407
|
measuredPercentageSize: void 0
|
|
408
408
|
};
|
|
409
409
|
}
|
|
410
|
-
return
|
|
411
|
-
},
|
|
410
|
+
return Le(n);
|
|
411
|
+
}, Le = (t) => {
|
|
412
412
|
let e = 0;
|
|
413
413
|
for (const r of t)
|
|
414
414
|
r.collapsed || (e += Math.max(r.size, 0));
|
|
415
415
|
if (e <= 0) {
|
|
416
416
|
let r = !1;
|
|
417
|
-
const
|
|
417
|
+
const c = t.map((i) => (i.percentageSize ?? 0) !== 0 ? (r = !0, {
|
|
418
418
|
...i,
|
|
419
419
|
percentageSize: 0,
|
|
420
420
|
measuredPercentageSize: i.measuredPercentageSize !== void 0 ? 0 : i.measuredPercentageSize
|
|
@@ -422,7 +422,7 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
422
422
|
...i,
|
|
423
423
|
sizeBeforeCollapse: i.size
|
|
424
424
|
}) : i);
|
|
425
|
-
return r ?
|
|
425
|
+
return r ? c : t;
|
|
426
426
|
}
|
|
427
427
|
let n = !1;
|
|
428
428
|
const d = t.map((r) => {
|
|
@@ -432,21 +432,21 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
432
432
|
percentageSize: 0,
|
|
433
433
|
measuredPercentageSize: r.measuredPercentageSize !== void 0 ? 0 : r.measuredPercentageSize
|
|
434
434
|
}) : r;
|
|
435
|
-
const
|
|
436
|
-
if (!(o ||
|
|
435
|
+
const c = Ce(r.size, e), i = r.measuredPercentageSize, z = (i !== void 0 ? Math.abs(i - c) : 1 / 0) < 1e-4 && i !== void 0 ? i : c, s = xt(z, bt), o = Math.abs((r.percentageSize ?? 0) - s) > 0 || r.percentageSize === void 0, h = r.sizeBeforeCollapse === void 0 || r.sizeBeforeCollapse !== r.size, b = De(r), m = b && h, v = r.measuredPixelSize ?? r.size, x = b && (r.measuredPixelSizeBeforeCollapse === void 0 || r.measuredPixelSizeBeforeCollapse !== v);
|
|
436
|
+
if (!(o || m || x))
|
|
437
437
|
return r;
|
|
438
438
|
n = !0;
|
|
439
|
-
const
|
|
439
|
+
const C = m ? r.size : r.sizeBeforeCollapse, S = x ? v : r.measuredPixelSizeBeforeCollapse;
|
|
440
440
|
return {
|
|
441
441
|
...r,
|
|
442
442
|
percentageSize: s,
|
|
443
|
-
sizeBeforeCollapse:
|
|
444
|
-
measuredPixelSizeBeforeCollapse:
|
|
443
|
+
sizeBeforeCollapse: C,
|
|
444
|
+
measuredPixelSizeBeforeCollapse: S,
|
|
445
445
|
collapsedByDirection: r.collapsed ? r.collapsedByDirection ?? null : null
|
|
446
446
|
};
|
|
447
447
|
});
|
|
448
448
|
return n ? d : t;
|
|
449
|
-
},
|
|
449
|
+
}, Ze = (t, e) => {
|
|
450
450
|
if (e <= 0)
|
|
451
451
|
return !1;
|
|
452
452
|
const n = [];
|
|
@@ -460,34 +460,34 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
460
460
|
let r = e - d;
|
|
461
461
|
if (Math.abs(r) <= 0)
|
|
462
462
|
return !1;
|
|
463
|
-
let
|
|
463
|
+
let c = !1;
|
|
464
464
|
const i = (s) => {
|
|
465
|
-
const a = t[s], o =
|
|
465
|
+
const a = t[s], o = te(a.minSize, 0, e), h = te(a.autoMinSize, 0, e), b = Math.max(o, h), m = te(a.maxSize, e, e), v = a.sizeUnit === "percentage" && a.originalPixelSize === void 0;
|
|
466
466
|
return {
|
|
467
467
|
index: s,
|
|
468
|
-
minSize:
|
|
469
|
-
maxSize:
|
|
468
|
+
minSize: b,
|
|
469
|
+
maxSize: m,
|
|
470
470
|
isFlexible: v
|
|
471
471
|
};
|
|
472
|
-
},
|
|
472
|
+
}, p = (s, a) => {
|
|
473
473
|
if (!Number.isFinite(a) || Math.abs(a) <= 0)
|
|
474
474
|
return;
|
|
475
475
|
const o = t[s];
|
|
476
476
|
if (!o)
|
|
477
477
|
return;
|
|
478
|
-
const
|
|
479
|
-
if (Math.abs(
|
|
478
|
+
const h = Math.max(0, o.size + a);
|
|
479
|
+
if (Math.abs(h - o.size) <= 0)
|
|
480
480
|
return;
|
|
481
|
-
const
|
|
481
|
+
const b = Ce(h, e), m = De(o), v = m ? h : o.sizeBeforeCollapse, x = m ? o.measuredPixelSizeBeforeCollapse ?? o.measuredPixelSize ?? h : o.measuredPixelSizeBeforeCollapse;
|
|
482
482
|
t[s] = {
|
|
483
483
|
...o,
|
|
484
|
-
size:
|
|
485
|
-
percentageSize:
|
|
484
|
+
size: h,
|
|
485
|
+
percentageSize: b,
|
|
486
486
|
sizeBeforeCollapse: v,
|
|
487
|
-
measuredPixelSizeBeforeCollapse:
|
|
487
|
+
measuredPixelSizeBeforeCollapse: x,
|
|
488
488
|
measuredPixelSize: void 0,
|
|
489
489
|
measuredPercentageSize: void 0
|
|
490
|
-
}, r -= a,
|
|
490
|
+
}, r -= a, c = !0;
|
|
491
491
|
}, u = (s) => {
|
|
492
492
|
for (const a of s) {
|
|
493
493
|
if (Math.abs(r) <= 0)
|
|
@@ -495,46 +495,46 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
495
495
|
const o = t[a.index];
|
|
496
496
|
if (!o || o.collapsed)
|
|
497
497
|
continue;
|
|
498
|
-
const
|
|
498
|
+
const h = o.size;
|
|
499
499
|
if (r > 0) {
|
|
500
|
-
const
|
|
501
|
-
if (
|
|
500
|
+
const b = Math.max(0, a.maxSize - h);
|
|
501
|
+
if (b <= 0)
|
|
502
502
|
continue;
|
|
503
|
-
const
|
|
504
|
-
if (
|
|
503
|
+
const m = Math.min(b, r);
|
|
504
|
+
if (m <= 0)
|
|
505
505
|
continue;
|
|
506
|
-
|
|
506
|
+
p(a.index, m);
|
|
507
507
|
} else {
|
|
508
|
-
const
|
|
509
|
-
if (
|
|
508
|
+
const b = Math.max(0, h - a.minSize);
|
|
509
|
+
if (b <= 0)
|
|
510
510
|
continue;
|
|
511
|
-
const
|
|
512
|
-
if (
|
|
511
|
+
const m = Math.min(b, Math.abs(r));
|
|
512
|
+
if (m <= 0)
|
|
513
513
|
continue;
|
|
514
|
-
|
|
514
|
+
p(a.index, -m);
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
517
|
}, z = n.map((s) => i(s)).filter((s) => s.isFlexible);
|
|
518
518
|
if (z.length > 0 && u(z), Math.abs(r) > 0) {
|
|
519
519
|
const s = r;
|
|
520
|
-
r =
|
|
520
|
+
r = Ct(t, r, e, { enforceAutoMinSize: !0 }), Math.abs(r - s) > 0 && (c = !0);
|
|
521
521
|
}
|
|
522
|
-
return
|
|
523
|
-
},
|
|
522
|
+
return c;
|
|
523
|
+
}, at = (t, e, n) => {
|
|
524
524
|
if (!(t.sizeUnit === "pixels" || t.originalPixelSize !== void 0) || t.pixelAdjustPriority !== void 0)
|
|
525
525
|
return t;
|
|
526
|
-
const r = e.filter((i,
|
|
526
|
+
const r = e.filter((i, p) => p !== n && (i.sizeUnit === "pixels" || i.originalPixelSize !== void 0)).map((i) => i.pixelAdjustPriority).filter((i) => i !== void 0), c = r.length > 0 ? Math.max(...r) + 1 : 1;
|
|
527
527
|
return {
|
|
528
528
|
...t,
|
|
529
|
-
pixelAdjustPriority:
|
|
529
|
+
pixelAdjustPriority: c
|
|
530
530
|
};
|
|
531
531
|
}, Dt = (t, e) => {
|
|
532
532
|
switch (e.type) {
|
|
533
533
|
case "REGISTER_PANEL": {
|
|
534
|
-
|
|
535
|
-
const n = t.findIndex((
|
|
534
|
+
ze.debug("REGISTER_PANEL", e.panel);
|
|
535
|
+
const n = t.findIndex((c) => c.id === e.panel.id);
|
|
536
536
|
if (n >= 0) {
|
|
537
|
-
const
|
|
537
|
+
const c = [...t], i = t[n], p = {
|
|
538
538
|
...i,
|
|
539
539
|
minSize: e.panel.minSize,
|
|
540
540
|
maxSize: e.panel.maxSize,
|
|
@@ -549,97 +549,97 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
549
549
|
pixelAdjustPriority: e.panel.pixelAdjustPriority !== void 0 ? e.panel.pixelAdjustPriority : i.pixelAdjustPriority,
|
|
550
550
|
autoMinSize: e.panel.autoMinSize !== void 0 ? e.panel.autoMinSize : i.autoMinSize,
|
|
551
551
|
excludeFromAutoGrowth: e.panel.excludeFromAutoGrowth !== void 0 ? e.panel.excludeFromAutoGrowth : i.excludeFromAutoGrowth
|
|
552
|
-
}, u =
|
|
553
|
-
return
|
|
552
|
+
}, u = at(p, t, n);
|
|
553
|
+
return ze.debug("register panel (update)", {
|
|
554
554
|
panelId: u.id,
|
|
555
|
-
incoming:
|
|
556
|
-
previous:
|
|
557
|
-
next:
|
|
558
|
-
}),
|
|
555
|
+
incoming: Ye(e.panel),
|
|
556
|
+
previous: Ye(i),
|
|
557
|
+
next: Ye(u)
|
|
558
|
+
}), c[n] = u, c;
|
|
559
559
|
}
|
|
560
|
-
const d = { ...e.panel }, r =
|
|
561
|
-
return
|
|
560
|
+
const d = { ...e.panel }, r = at(d, t);
|
|
561
|
+
return ze.debug("register panel (insert)", {
|
|
562
562
|
panelId: r.id,
|
|
563
|
-
incoming:
|
|
563
|
+
incoming: Ye(r),
|
|
564
564
|
previousLength: t.length
|
|
565
565
|
}), [...t, r];
|
|
566
566
|
}
|
|
567
567
|
case "UNREGISTER_PANEL": {
|
|
568
|
-
|
|
569
|
-
const n = t.filter((r) => r.id !== e.id), d =
|
|
570
|
-
return
|
|
568
|
+
ze.debug("UNREGISTER_PANEL", e.id);
|
|
569
|
+
const n = t.filter((r) => r.id !== e.id), d = Le(n);
|
|
570
|
+
return ze.debug("unregister panel", {
|
|
571
571
|
panelId: e.id,
|
|
572
|
-
previous:
|
|
573
|
-
filtered:
|
|
574
|
-
next:
|
|
572
|
+
previous: ve(t),
|
|
573
|
+
filtered: ve(n),
|
|
574
|
+
next: ve(d)
|
|
575
575
|
}), d;
|
|
576
576
|
}
|
|
577
577
|
case "RESIZE_PANELS": {
|
|
578
|
-
|
|
579
|
-
const n = t.findIndex((
|
|
578
|
+
ze.debug("RESIZE_PANELS", e.leftId, e.rightId, e.leftSize, e.rightSize);
|
|
579
|
+
const n = t.findIndex((G) => G.id === e.leftId), d = t.findIndex((G) => G.id === e.rightId);
|
|
580
580
|
if (n === -1 || d === -1) return t;
|
|
581
|
-
const r = [...t],
|
|
582
|
-
if (
|
|
581
|
+
const r = [...t], c = r[n], i = r[d];
|
|
582
|
+
if (c.collapsed || i.collapsed || e.leftSize === c.size && e.rightSize === i.size)
|
|
583
583
|
return t;
|
|
584
|
-
const
|
|
585
|
-
let
|
|
586
|
-
Number.isFinite(
|
|
587
|
-
const
|
|
588
|
-
min: Math.max(u,
|
|
589
|
-
max: Math.min(z,
|
|
590
|
-
}), X = (
|
|
591
|
-
min: Math.max(s,
|
|
592
|
-
max: Math.min(a,
|
|
593
|
-
}),
|
|
594
|
-
let
|
|
595
|
-
if (
|
|
596
|
-
const
|
|
597
|
-
if (
|
|
584
|
+
const p = e.containerSize ?? t.reduce((G, le) => G + le.size, 0), u = te(c.minSize, 0, p), z = te(c.maxSize, p, p), s = te(i.minSize, 0, p), a = te(i.maxSize, p, p), o = c.size + i.size, h = t.reduce((G, le) => le.collapsed ? G : G + le.size, 0), b = h - o, m = u + s, v = z + a, x = me(e.leftSize + e.rightSize, m, v);
|
|
585
|
+
let C = p > 0 ? p - b : x;
|
|
586
|
+
Number.isFinite(C) || (C = x);
|
|
587
|
+
const S = me(Math.max(x, C), m, v), D = (G) => ({
|
|
588
|
+
min: Math.max(u, G - a),
|
|
589
|
+
max: Math.min(z, G - s)
|
|
590
|
+
}), X = (G) => ({
|
|
591
|
+
min: Math.max(s, G - z),
|
|
592
|
+
max: Math.min(a, G - u)
|
|
593
|
+
}), re = Math.abs(e.leftSize - c.size), de = Math.abs(e.rightSize - i.size), j = re >= de;
|
|
594
|
+
let _ = c.size, E = i.size;
|
|
595
|
+
if (j) {
|
|
596
|
+
const G = D(S);
|
|
597
|
+
if (G.min > G.max)
|
|
598
598
|
return t;
|
|
599
|
-
const
|
|
600
|
-
if (
|
|
599
|
+
const le = me(e.leftSize, G.min, G.max), P = S - le;
|
|
600
|
+
if (P < s || P > a)
|
|
601
601
|
return t;
|
|
602
|
-
|
|
602
|
+
_ = le, E = P;
|
|
603
603
|
} else {
|
|
604
|
-
const
|
|
605
|
-
if (
|
|
604
|
+
const G = X(S);
|
|
605
|
+
if (G.min > G.max)
|
|
606
606
|
return t;
|
|
607
|
-
const
|
|
608
|
-
if (
|
|
607
|
+
const le = me(e.rightSize, G.min, G.max), P = S - le;
|
|
608
|
+
if (P < u || P > z)
|
|
609
609
|
return t;
|
|
610
|
-
|
|
610
|
+
E = le, _ = P;
|
|
611
611
|
}
|
|
612
|
-
const
|
|
613
|
-
if (
|
|
612
|
+
const oe = _ + E;
|
|
613
|
+
if (S !== oe)
|
|
614
614
|
return t;
|
|
615
|
-
const
|
|
616
|
-
let
|
|
617
|
-
|
|
618
|
-
const
|
|
615
|
+
const U = h - c.size - i.size + oe, V = p > 0 ? p : U, O = V > 0 ? Ce(_, V) : 0, Y = V > 0 ? Ce(E, V) : 0, y = c.sizeUnit === "pixels" || c.originalPixelSize !== void 0 ? _ : c.preferredPixelSize, N = i.sizeUnit === "pixels" || i.originalPixelSize !== void 0 ? E : i.preferredPixelSize, be = te(c.autoMinSize, 0, p), ce = te(i.autoMinSize, 0, p), Pe = Math.max(1e-3, be), he = Math.max(1e-3, ce), ue = c.sizeUnit === "percentage" && c.originalPixelSize === void 0, pe = i.sizeUnit === "percentage" && i.originalPixelSize === void 0;
|
|
616
|
+
let ge = c.excludeFromAutoGrowth, ye = i.excludeFromAutoGrowth;
|
|
617
|
+
ue && (_ <= Pe ? ge = !0 : _ > Pe && (ge = !1)), pe && (E <= he ? ye = !0 : E > he && (ye = !1));
|
|
618
|
+
const Be = De(c), Re = De(i);
|
|
619
619
|
return r[n] = {
|
|
620
|
-
...
|
|
621
|
-
size:
|
|
622
|
-
percentageSize:
|
|
623
|
-
preferredPercentageSize:
|
|
624
|
-
preferredPixelSize:
|
|
625
|
-
sizeBeforeCollapse:
|
|
620
|
+
...c,
|
|
621
|
+
size: _,
|
|
622
|
+
percentageSize: O,
|
|
623
|
+
preferredPercentageSize: O > 0 ? O : c.preferredPercentageSize,
|
|
624
|
+
preferredPixelSize: y,
|
|
625
|
+
sizeBeforeCollapse: Be ? _ : c.sizeBeforeCollapse,
|
|
626
626
|
measuredPixelSize: void 0,
|
|
627
627
|
measuredPercentageSize: void 0,
|
|
628
|
-
excludeFromAutoGrowth:
|
|
628
|
+
excludeFromAutoGrowth: ge
|
|
629
629
|
}, r[d] = {
|
|
630
630
|
...i,
|
|
631
|
-
size:
|
|
632
|
-
percentageSize:
|
|
633
|
-
preferredPercentageSize:
|
|
634
|
-
preferredPixelSize:
|
|
635
|
-
sizeBeforeCollapse:
|
|
631
|
+
size: E,
|
|
632
|
+
percentageSize: Y,
|
|
633
|
+
preferredPercentageSize: Y > 0 ? Y : i.preferredPercentageSize,
|
|
634
|
+
preferredPixelSize: N,
|
|
635
|
+
sizeBeforeCollapse: Re ? E : i.sizeBeforeCollapse,
|
|
636
636
|
measuredPixelSize: void 0,
|
|
637
637
|
measuredPercentageSize: void 0,
|
|
638
|
-
excludeFromAutoGrowth:
|
|
639
|
-
},
|
|
638
|
+
excludeFromAutoGrowth: ye
|
|
639
|
+
}, p > 0 && Ze(r, p) ? Le(r) : r;
|
|
640
640
|
}
|
|
641
641
|
case "SET_PANELS": {
|
|
642
|
-
|
|
642
|
+
ze.debug("SET_PANELS", e.panels);
|
|
643
643
|
const n = e.panels.map((u) => {
|
|
644
644
|
const z = u.sizeUnit === "pixels" || u.originalPixelSize !== void 0, s = u.preferredPercentageSize !== void 0 ? u.preferredPercentageSize : u.percentageSize, a = u.preferredPixelSize !== void 0 ? u.preferredPixelSize : z ? u.size : u.preferredPixelSize;
|
|
645
645
|
return {
|
|
@@ -647,69 +647,69 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
647
647
|
preferredPercentageSize: s,
|
|
648
648
|
preferredPixelSize: a
|
|
649
649
|
};
|
|
650
|
-
}), d =
|
|
651
|
-
let
|
|
652
|
-
if (
|
|
650
|
+
}), d = ve(t), r = ve(n), c = Le(n), i = ve(c);
|
|
651
|
+
let p = d.length === i.length;
|
|
652
|
+
if (p)
|
|
653
653
|
for (let u = 0; u < i.length; u += 1) {
|
|
654
654
|
const z = i[u], s = d[u];
|
|
655
655
|
if (!s) {
|
|
656
|
-
|
|
656
|
+
p = !1;
|
|
657
657
|
break;
|
|
658
658
|
}
|
|
659
659
|
if (!(s.id === z.id && s.size === z.size && s.percentageSize === z.percentageSize && s.sizeBeforeCollapse === z.sizeBeforeCollapse && s.measuredPercentageSize === z.measuredPercentageSize && s.collapsed === z.collapsed)) {
|
|
660
|
-
|
|
660
|
+
p = !1;
|
|
661
661
|
break;
|
|
662
662
|
}
|
|
663
663
|
}
|
|
664
|
-
return
|
|
664
|
+
return p ? (ze.debug("set panels skipped (no diff)", {
|
|
665
665
|
previous: d,
|
|
666
666
|
incoming: r,
|
|
667
667
|
next: i,
|
|
668
668
|
previousLength: d.length,
|
|
669
669
|
incomingLength: r.length
|
|
670
|
-
}), t) : (
|
|
670
|
+
}), t) : (ze.debug("set panels", {
|
|
671
671
|
previous: d,
|
|
672
672
|
incoming: r,
|
|
673
673
|
next: i,
|
|
674
674
|
previousLength: d.length,
|
|
675
675
|
incomingLength: r.length
|
|
676
|
-
}),
|
|
676
|
+
}), c);
|
|
677
677
|
}
|
|
678
678
|
case "CONTAINER_RESIZED": {
|
|
679
|
-
if (
|
|
680
|
-
return
|
|
679
|
+
if (ze.debug("CONTAINER_RESIZED", e.containerSize), e.containerSize <= 0)
|
|
680
|
+
return ze.debug("container resized skipped (non-positive size)", {
|
|
681
681
|
containerSize: e.containerSize,
|
|
682
|
-
panels:
|
|
682
|
+
panels: ve(t)
|
|
683
683
|
}), t;
|
|
684
|
-
|
|
684
|
+
ze.debug("container resized (before)", {
|
|
685
685
|
containerSize: e.containerSize,
|
|
686
|
-
panels:
|
|
686
|
+
panels: ve(t)
|
|
687
687
|
});
|
|
688
|
-
const n =
|
|
689
|
-
if (
|
|
688
|
+
const n = Ke(t, e.containerSize);
|
|
689
|
+
if (ze.debug("container resized (after recalc)", {
|
|
690
690
|
containerSize: e.containerSize,
|
|
691
|
-
panels:
|
|
692
|
-
}), e.containerSize > 0 &&
|
|
693
|
-
const d =
|
|
694
|
-
return
|
|
691
|
+
panels: ve(n)
|
|
692
|
+
}), e.containerSize > 0 && Ze(n, e.containerSize)) {
|
|
693
|
+
const d = Le(n);
|
|
694
|
+
return ze.debug("container resized (after reconcile)", {
|
|
695
695
|
containerSize: e.containerSize,
|
|
696
|
-
panels:
|
|
696
|
+
panels: ve(d)
|
|
697
697
|
}), d;
|
|
698
698
|
}
|
|
699
|
-
return
|
|
699
|
+
return ze.debug("container resized (final)", {
|
|
700
700
|
containerSize: e.containerSize,
|
|
701
|
-
panels:
|
|
701
|
+
panels: ve(n)
|
|
702
702
|
}), n;
|
|
703
703
|
}
|
|
704
704
|
case "COLLAPSE_PANEL": {
|
|
705
|
-
|
|
705
|
+
ze.debug("COLLAPSE_PANEL", e.id);
|
|
706
706
|
const n = t.findIndex((o) => o.id === e.id);
|
|
707
707
|
if (n === -1)
|
|
708
708
|
return t;
|
|
709
709
|
const d = t[n], r = e.from === "start" ? d.collapseFromStart : d.collapseFromEnd;
|
|
710
|
-
if (!(
|
|
710
|
+
if (!(De(d) && r) || d.collapsed)
|
|
711
711
|
return t;
|
|
712
|
-
const i = d.size,
|
|
712
|
+
const i = d.size, p = d.measuredPixelSize ?? i, u = d.percentageSize ?? d.preferredPercentageSize ?? 0, z = {
|
|
713
713
|
...d,
|
|
714
714
|
collapsed: !0,
|
|
715
715
|
collapsedByDirection: e.from,
|
|
@@ -717,7 +717,7 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
717
717
|
percentageSizeBeforeCollapse: u,
|
|
718
718
|
preferredPercentageSizeBeforeCollapse: d.preferredPercentageSize ?? u,
|
|
719
719
|
preferredPixelSizeBeforeCollapse: d.preferredPixelSize ?? i,
|
|
720
|
-
measuredPixelSizeBeforeCollapse:
|
|
720
|
+
measuredPixelSizeBeforeCollapse: p,
|
|
721
721
|
size: 0,
|
|
722
722
|
percentageSize: 0,
|
|
723
723
|
preferredPercentageSize: d.preferredPercentageSize,
|
|
@@ -725,392 +725,407 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
725
725
|
measuredPercentageSize: d.measuredPercentageSize !== void 0 ? 0 : d.measuredPercentageSize
|
|
726
726
|
}, s = [...t];
|
|
727
727
|
s[n] = z;
|
|
728
|
-
const a =
|
|
729
|
-
return e.containerSize > 0 &&
|
|
728
|
+
const a = Ke(s, e.containerSize);
|
|
729
|
+
return e.containerSize > 0 && Ze(a, e.containerSize) ? Le(a) : a;
|
|
730
730
|
}
|
|
731
731
|
case "EXPAND_PANEL": {
|
|
732
|
-
|
|
733
|
-
const n = t.findIndex((
|
|
732
|
+
ze.debug("EXPAND_PANEL", e.id, e.targetSize);
|
|
733
|
+
const n = t.findIndex((S) => S.id === e.id);
|
|
734
734
|
if (n === -1)
|
|
735
735
|
return t;
|
|
736
|
-
const d = e.containerSize, r = t[n],
|
|
737
|
-
if (!(
|
|
736
|
+
const d = e.containerSize, r = t[n], c = e.from === "start" ? r.collapseFromStart : r.collapseFromEnd;
|
|
737
|
+
if (!(De(r) && c && r.collapsed) || r.collapsedByDirection && r.collapsedByDirection !== e.from)
|
|
738
738
|
return t;
|
|
739
|
-
const
|
|
739
|
+
const p = [e.targetSize, r.sizeBeforeCollapse, r.measuredPixelSizeBeforeCollapse, r.preferredPixelSizeBeforeCollapse, r.originalPixelSize].find((S) => S !== void 0) ?? 0, u = te(r.minSize, 0, d), z = te(r.maxSize, d, d), s = me(p, u, z), a = Ce(s, d), o = r.measuredPixelSizeBeforeCollapse ?? s, h = Ce(o, d), b = r.preferredPercentageSizeBeforeCollapse ?? r.percentageSizeBeforeCollapse ?? a, m = r.preferredPixelSizeBeforeCollapse ?? r.preferredPixelSize ?? s, v = {
|
|
740
740
|
...r,
|
|
741
741
|
collapsed: !1,
|
|
742
742
|
collapsedByDirection: null,
|
|
743
743
|
size: s,
|
|
744
744
|
percentageSize: a,
|
|
745
|
-
preferredPercentageSize:
|
|
746
|
-
preferredPixelSize:
|
|
745
|
+
preferredPercentageSize: b,
|
|
746
|
+
preferredPixelSize: m,
|
|
747
747
|
sizeBeforeCollapse: s,
|
|
748
748
|
percentageSizeBeforeCollapse: void 0,
|
|
749
749
|
preferredPercentageSizeBeforeCollapse: void 0,
|
|
750
750
|
preferredPixelSizeBeforeCollapse: void 0,
|
|
751
751
|
measuredPixelSize: s,
|
|
752
752
|
measuredPixelSizeBeforeCollapse: o,
|
|
753
|
-
measuredPercentageSize:
|
|
754
|
-
},
|
|
755
|
-
|
|
756
|
-
const
|
|
757
|
-
return d > 0 &&
|
|
753
|
+
measuredPercentageSize: h
|
|
754
|
+
}, x = [...t];
|
|
755
|
+
x[n] = v;
|
|
756
|
+
const C = Ke(x, d);
|
|
757
|
+
return d > 0 && Ze(C, d) ? Le(C) : C;
|
|
758
758
|
}
|
|
759
759
|
default:
|
|
760
760
|
return t;
|
|
761
761
|
}
|
|
762
|
-
},
|
|
763
|
-
const [
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
}, [
|
|
767
|
-
|
|
768
|
-
}, [z]),
|
|
769
|
-
|
|
770
|
-
}, [
|
|
771
|
-
if (
|
|
762
|
+
}, Ue = new je(qe.INFO, "[resize-panels]"), Ot = ({ direction: t, style: e, onLayout: n, autoSaveId: d, showDebugInfo: r = !1 }) => {
|
|
763
|
+
const [c, i] = wt(Dt, []), [p, u] = Me({ width: 0, height: 0 }), [z, s] = Me(!1), [a, o] = Me(!1), [h, b] = Me(null), [m, v] = Me({}), [x, C] = Me({}), S = J(null), D = J(n), X = J(!1), re = J(0), de = J(p), j = J(p), _ = J(z), E = J(h?.reason ?? null), oe = J({}), U = J(null), V = J(null), O = J(null), Y = J({ width: 0, height: 0 }), y = J({ width: 0, height: 0 }), N = J({}), be = J({}), ce = Se((l) => l.map((g) => ({ ...g })), []);
|
|
764
|
+
se(() => {
|
|
765
|
+
j.current = p;
|
|
766
|
+
}, [p]), se(() => {
|
|
767
|
+
_.current = z;
|
|
768
|
+
}, [z]), se(() => {
|
|
769
|
+
E.current = h?.reason ?? null;
|
|
770
|
+
}, [h?.reason]), se(() => {
|
|
771
|
+
if (h)
|
|
772
772
|
return;
|
|
773
|
-
const
|
|
774
|
-
!Number.isFinite(
|
|
775
|
-
}, [
|
|
776
|
-
const
|
|
777
|
-
if (
|
|
778
|
-
|
|
773
|
+
const l = t === "horizontal" ? p.width : p.height;
|
|
774
|
+
!Number.isFinite(l) || l <= 4 || c.length !== 0 && (U.current = ce(c));
|
|
775
|
+
}, [h, c, t, p.width, p.height, ce]), se(() => {
|
|
776
|
+
const l = V.current;
|
|
777
|
+
if (h) {
|
|
778
|
+
V.current = h;
|
|
779
779
|
return;
|
|
780
780
|
}
|
|
781
|
-
if (
|
|
782
|
-
|
|
783
|
-
const g =
|
|
781
|
+
if (l && !h && U.current) {
|
|
782
|
+
V.current = null;
|
|
783
|
+
const g = ce(U.current);
|
|
784
784
|
i({ type: "SET_PANELS", panels: g });
|
|
785
785
|
return;
|
|
786
786
|
}
|
|
787
|
-
|
|
788
|
-
}, [
|
|
789
|
-
if (!
|
|
790
|
-
const
|
|
791
|
-
for (const
|
|
792
|
-
const
|
|
793
|
-
|
|
787
|
+
V.current = h;
|
|
788
|
+
}, [h, ce]), Xe(() => {
|
|
789
|
+
if (!S.current) return;
|
|
790
|
+
const l = new ResizeObserver((g) => {
|
|
791
|
+
for (const w of g) {
|
|
792
|
+
const M = w.target, A = M ? Oe(M, "horizontal") : null, B = M ? Oe(M, "vertical") : null, H = A ? A.inner : 0, Z = B ? B.inner : 0, T = w.contentRect.width, R = w.contentRect.height, F = H > 0 ? H : T, k = Z > 0 ? Z : R;
|
|
793
|
+
Y.current = { width: F, height: k };
|
|
794
|
+
const Q = y.current, ne = Math.abs(Q.width - F) >= 0.5, K = Math.abs(Q.height - k) >= 0.5;
|
|
795
|
+
ne || K ? (O.current && (clearTimeout(O.current), O.current = null), !z && F > 0 && k > 0 && s(!0), u({ width: F, height: k }), y.current = { width: F, height: k }) : (O.current && clearTimeout(O.current), O.current = setTimeout(() => {
|
|
796
|
+
const W = Y.current;
|
|
797
|
+
u(W), y.current = W, O.current = null;
|
|
798
|
+
}, 150));
|
|
794
799
|
}
|
|
795
800
|
});
|
|
796
|
-
return
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
801
|
+
return l.observe(S.current), () => {
|
|
802
|
+
l.disconnect(), O.current && clearTimeout(O.current);
|
|
803
|
+
};
|
|
804
|
+
}, [z]), se(() => () => {
|
|
805
|
+
Object.values(N.current).forEach(clearTimeout);
|
|
806
|
+
}, []), Xe(() => {
|
|
807
|
+
const l = de.current, g = p, w = t === "horizontal" ? Math.abs(l.width - g.width) >= 0.5 : Math.abs(l.height - g.height) >= 0.5;
|
|
808
|
+
if (a && w) {
|
|
809
|
+
const M = t === "horizontal" ? g.width : g.height;
|
|
810
|
+
i({ type: "CONTAINER_RESIZED", containerSize: M, direction: t });
|
|
802
811
|
}
|
|
803
|
-
|
|
804
|
-
}, [
|
|
805
|
-
const
|
|
806
|
-
|
|
807
|
-
const
|
|
808
|
-
if (
|
|
812
|
+
de.current = g;
|
|
813
|
+
}, [p, a, t]);
|
|
814
|
+
const Pe = Se(() => {
|
|
815
|
+
Ue.debug("panels[0]?.id", c[0]?.id);
|
|
816
|
+
const l = c.some((f) => {
|
|
817
|
+
if (f.collapsed || f.sizeUnit !== "percentage")
|
|
809
818
|
return !1;
|
|
810
|
-
const
|
|
811
|
-
return
|
|
812
|
-
}), g = t === "horizontal" ?
|
|
813
|
-
if (
|
|
819
|
+
const ee = f.collapseFromStart || f.collapseFromEnd ? f.sizeBeforeCollapse ?? f.measuredPixelSizeBeforeCollapse ?? f.originalPixelSize ?? f.measuredPixelSize ?? 0 : f.measuredPixelSize ?? f.originalPixelSize ?? f.size, ie = f.percentageSize !== void 0 && f.percentageSize > 0;
|
|
820
|
+
return f.size <= 0 && (ee > 0 || ie);
|
|
821
|
+
}), g = t === "horizontal" ? p.width : p.height, w = g > 0;
|
|
822
|
+
if (h || !w || !(c.length > 0 && (c.length !== re.current || !a || l)))
|
|
814
823
|
return;
|
|
815
|
-
const
|
|
816
|
-
const
|
|
817
|
-
return
|
|
818
|
-
}, 0),
|
|
819
|
-
const
|
|
820
|
-
return
|
|
821
|
-
}),
|
|
822
|
-
if (
|
|
823
|
-
const
|
|
824
|
+
const B = c.filter((f) => !f.collapsed && (f.originalPixelSize !== void 0 || f.sizeUnit === "pixels")).reduce((f, L) => {
|
|
825
|
+
const ee = L.preferredPixelSize ?? L.originalPixelSize ?? L.size;
|
|
826
|
+
return f + Math.max(0, ee ?? 0);
|
|
827
|
+
}, 0), H = c.filter((f) => f.sizeUnit === "percentage" && !f.collapsed), Z = H.map((f) => f.id), T = H.map((f) => {
|
|
828
|
+
const L = f.preferredPercentageSize ?? f.percentageSize;
|
|
829
|
+
return L !== void 0 && L > 0 ? We(L, g) : f.size > 0 ? f.size : 0;
|
|
830
|
+
}), R = T.reduce((f, L) => f + L, 0), F = g - B, k = Math.max(0, F), Q = k > 0, ne = c.map((f) => {
|
|
831
|
+
if (f.collapsed) {
|
|
832
|
+
const L = f.sizeBeforeCollapse ?? f.measuredPixelSizeBeforeCollapse ?? f.originalPixelSize ?? (f.sizeUnit === "pixels" ? f.size : void 0), ee = f.sizeUnit === "percentage" && f.percentageSize !== void 0 ? We(f.percentageSize, g) : void 0, ie = L ?? ee ?? 0, xe = f.measuredPixelSizeBeforeCollapse ?? f.measuredPixelSize ?? ie;
|
|
824
833
|
return {
|
|
825
|
-
...
|
|
834
|
+
...f,
|
|
826
835
|
size: 0,
|
|
827
836
|
percentageSize: 0,
|
|
828
|
-
preferredPercentageSize:
|
|
829
|
-
sizeBeforeCollapse:
|
|
830
|
-
percentageSizeBeforeCollapse:
|
|
831
|
-
preferredPercentageSizeBeforeCollapse:
|
|
832
|
-
preferredPixelSizeBeforeCollapse:
|
|
833
|
-
measuredPixelSizeBeforeCollapse:
|
|
837
|
+
preferredPercentageSize: f.preferredPercentageSize,
|
|
838
|
+
sizeBeforeCollapse: ie,
|
|
839
|
+
percentageSizeBeforeCollapse: f.percentageSizeBeforeCollapse ?? f.percentageSize ?? f.preferredPercentageSize ?? 0,
|
|
840
|
+
preferredPercentageSizeBeforeCollapse: f.preferredPercentageSizeBeforeCollapse ?? f.preferredPercentageSize ?? f.percentageSize ?? void 0,
|
|
841
|
+
preferredPixelSizeBeforeCollapse: f.preferredPixelSizeBeforeCollapse ?? f.preferredPixelSize ?? ie,
|
|
842
|
+
measuredPixelSizeBeforeCollapse: xe
|
|
834
843
|
};
|
|
835
844
|
}
|
|
836
|
-
if (
|
|
837
|
-
const
|
|
838
|
-
...
|
|
839
|
-
size:
|
|
840
|
-
percentageSize:
|
|
841
|
-
preferredPixelSize:
|
|
842
|
-
preferredPercentageSize:
|
|
845
|
+
if (f.sizeUnit === "pixels" || f.originalPixelSize !== void 0) {
|
|
846
|
+
const L = f.size, ee = g > 0 ? Ce(L, g) : 0, ie = {
|
|
847
|
+
...f,
|
|
848
|
+
size: L,
|
|
849
|
+
percentageSize: ee,
|
|
850
|
+
preferredPixelSize: f.preferredPixelSize ?? f.originalPixelSize ?? L,
|
|
851
|
+
preferredPercentageSize: f.preferredPercentageSize !== void 0 ? f.preferredPercentageSize : ee > 0 ? ee : void 0
|
|
843
852
|
};
|
|
844
|
-
if (
|
|
845
|
-
const
|
|
846
|
-
|
|
853
|
+
if (f.collapseFromStart || f.collapseFromEnd) {
|
|
854
|
+
const xe = f.sizeBeforeCollapse ?? L, Ne = f.measuredPixelSizeBeforeCollapse ?? f.measuredPixelSize ?? xe;
|
|
855
|
+
ie.sizeBeforeCollapse = xe, ie.measuredPixelSizeBeforeCollapse = Ne, ie.preferredPixelSizeBeforeCollapse = f.preferredPixelSizeBeforeCollapse ?? f.preferredPixelSize ?? xe;
|
|
847
856
|
}
|
|
848
|
-
return
|
|
857
|
+
return ie;
|
|
849
858
|
}
|
|
850
|
-
if (
|
|
851
|
-
const
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
+
if (f.sizeUnit === "percentage") {
|
|
860
|
+
const L = Z.indexOf(f.id), ee = L !== -1 ? T[L] : 0, ie = te(f.minSize, 0, g), xe = te(f.maxSize, g, g), Ne = Math.max(
|
|
861
|
+
ie,
|
|
862
|
+
f.sizeBeforeCollapse ?? 0,
|
|
863
|
+
f.measuredPixelSizeBeforeCollapse ?? 0,
|
|
864
|
+
f.measuredPixelSize ?? 0,
|
|
865
|
+
f.originalPixelSize ?? 0,
|
|
866
|
+
f.size > 0 ? f.size : 0,
|
|
867
|
+
f.percentageSize !== void 0 ? We(f.percentageSize, g) : 0,
|
|
859
868
|
1
|
|
860
|
-
),
|
|
861
|
-
let
|
|
862
|
-
if (!
|
|
863
|
-
|
|
864
|
-
else if (
|
|
865
|
-
const
|
|
866
|
-
|
|
869
|
+
), ke = ee > 0 ? ee : Ne;
|
|
870
|
+
let Ae;
|
|
871
|
+
if (!Q)
|
|
872
|
+
Ae = ie;
|
|
873
|
+
else if (L !== -1 && R > 0) {
|
|
874
|
+
const we = ke / R, Ie = k * we;
|
|
875
|
+
Ae = me(Ie, ie, xe);
|
|
867
876
|
} else {
|
|
868
|
-
const
|
|
869
|
-
|
|
877
|
+
const we = f.percentageSize !== void 0 ? We(f.percentageSize, g) : f.size, Ie = we > 0 ? we : ke;
|
|
878
|
+
Ae = me(Ie, ie, xe);
|
|
870
879
|
}
|
|
871
|
-
const
|
|
872
|
-
...
|
|
873
|
-
size:
|
|
874
|
-
percentageSize:
|
|
875
|
-
preferredPercentageSize:
|
|
880
|
+
const Ge = g > 0 ? Ce(Ae, g) : 0, Te = {
|
|
881
|
+
...f,
|
|
882
|
+
size: Ae,
|
|
883
|
+
percentageSize: Ge,
|
|
884
|
+
preferredPercentageSize: f.preferredPercentageSize !== void 0 ? f.preferredPercentageSize : Ge > 0 ? Ge : void 0
|
|
876
885
|
};
|
|
877
|
-
if (
|
|
878
|
-
const
|
|
879
|
-
|
|
886
|
+
if (f.collapseFromStart || f.collapseFromEnd) {
|
|
887
|
+
const we = f.sizeBeforeCollapse ?? Ae, Ie = f.measuredPixelSizeBeforeCollapse ?? f.measuredPixelSize ?? we;
|
|
888
|
+
Te.sizeBeforeCollapse = we, Te.measuredPixelSizeBeforeCollapse = Ie, Te.preferredPixelSizeBeforeCollapse = f.preferredPixelSizeBeforeCollapse ?? f.preferredPixelSize ?? we;
|
|
880
889
|
}
|
|
881
|
-
return
|
|
890
|
+
return Te;
|
|
882
891
|
}
|
|
883
|
-
return
|
|
884
|
-
}),
|
|
885
|
-
for (let
|
|
886
|
-
const
|
|
887
|
-
|
|
892
|
+
return f;
|
|
893
|
+
}), K = [];
|
|
894
|
+
for (let f = 0; f < ne.length; f += 1) {
|
|
895
|
+
const L = ne[f];
|
|
896
|
+
L.sizeUnit === "percentage" && !L.collapsed && K.push(f);
|
|
888
897
|
}
|
|
889
|
-
const
|
|
890
|
-
Math.abs(
|
|
891
|
-
}, [
|
|
892
|
-
|
|
893
|
-
const
|
|
894
|
-
if (
|
|
895
|
-
return
|
|
896
|
-
const
|
|
897
|
-
return
|
|
898
|
-
}, 0) : null,
|
|
899
|
-
if (
|
|
900
|
-
return
|
|
901
|
-
const
|
|
902
|
-
return
|
|
903
|
-
}, 0) : null,
|
|
898
|
+
const W = K.reduce((f, L) => f + ne[L].size, 0), q = F - W;
|
|
899
|
+
Math.abs(q) > 0 && Ct(ne, q, g, { enforceAutoMinSize: !0 }), i({ type: "SET_PANELS", panels: ne }), re.current = c.length, o(!0);
|
|
900
|
+
}, [c, t, p.width, p.height, a, h]);
|
|
901
|
+
se(() => {
|
|
902
|
+
const l = t === "horizontal" ? p.width : p.height, g = l > 0, w = g && c.length > 0, M = w ? c.reduce((R, F) => {
|
|
903
|
+
if (F.collapsed)
|
|
904
|
+
return R;
|
|
905
|
+
const k = te(F.minSize, 0, l);
|
|
906
|
+
return R + Math.max(0, k);
|
|
907
|
+
}, 0) : null, A = w ? c.reduce((R, F) => {
|
|
908
|
+
if (F.collapsed)
|
|
909
|
+
return R;
|
|
910
|
+
const k = te(F.maxSize, l, l);
|
|
911
|
+
return R + Math.max(0, k);
|
|
912
|
+
}, 0) : null, B = M ?? h?.totalMinimumSize ?? null, H = A ?? h?.totalMaximumSize ?? null;
|
|
904
913
|
if (!g) {
|
|
905
|
-
|
|
906
|
-
reason:
|
|
914
|
+
h && b((R) => !R || R.availableContainerSize === l ? R : {
|
|
915
|
+
reason: R.reason,
|
|
907
916
|
// totalMinimumSize: previous.totalMinimumSize,
|
|
908
917
|
// totalMaximumSize: previous.totalMaximumSize,
|
|
909
918
|
totalMinimumSize: null,
|
|
910
919
|
totalMaximumSize: null,
|
|
911
|
-
availableContainerSize:
|
|
920
|
+
availableContainerSize: l
|
|
912
921
|
});
|
|
913
922
|
return;
|
|
914
923
|
}
|
|
915
|
-
const
|
|
916
|
-
if (
|
|
917
|
-
const
|
|
918
|
-
reason:
|
|
919
|
-
totalMinimumSize:
|
|
920
|
-
totalMaximumSize:
|
|
921
|
-
availableContainerSize:
|
|
924
|
+
const Z = B !== null && B - l > Number.EPSILON, T = H !== null && l - H > Number.EPSILON;
|
|
925
|
+
if (Z || T) {
|
|
926
|
+
const F = {
|
|
927
|
+
reason: Z ? "minimum-exceeded" : "maximum-insufficient",
|
|
928
|
+
totalMinimumSize: B,
|
|
929
|
+
totalMaximumSize: H,
|
|
930
|
+
availableContainerSize: l
|
|
922
931
|
};
|
|
923
|
-
|
|
932
|
+
b((k) => k && k.reason === F.reason && Math.abs((k.totalMinimumSize ?? 0) - (F.totalMinimumSize ?? 0)) <= Number.EPSILON && Math.abs((k.totalMaximumSize ?? 0) - (F.totalMaximumSize ?? 0)) <= Number.EPSILON && Math.abs(k.availableContainerSize - F.availableContainerSize) <= Number.EPSILON ? k : F);
|
|
924
933
|
return;
|
|
925
934
|
}
|
|
926
|
-
if (
|
|
927
|
-
const
|
|
928
|
-
(!
|
|
935
|
+
if (h) {
|
|
936
|
+
const R = h.reason === "minimum-exceeded", F = h.reason === "maximum-insufficient";
|
|
937
|
+
(!R || B !== null) && (!F || H !== null) && !Z && !T && b((W) => W && null);
|
|
929
938
|
}
|
|
930
|
-
}, [
|
|
931
|
-
|
|
932
|
-
}, [
|
|
939
|
+
}, [c, t, p.width, p.height, h]), se(() => {
|
|
940
|
+
Pe();
|
|
941
|
+
}, [Pe]), se(() => {
|
|
933
942
|
D.current = n;
|
|
934
943
|
}, [n]);
|
|
935
|
-
const
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
}, [
|
|
939
|
-
if (d &&
|
|
940
|
-
const
|
|
941
|
-
At(d,
|
|
944
|
+
const he = ae(() => c.map((l) => l.size), [c]);
|
|
945
|
+
Xe(() => {
|
|
946
|
+
he.length > 0 && D.current && D.current(he);
|
|
947
|
+
}, [he]), se(() => {
|
|
948
|
+
if (d && he.length > 0) {
|
|
949
|
+
const l = setTimeout(() => {
|
|
950
|
+
At(d, he);
|
|
942
951
|
}, 200);
|
|
943
|
-
return () => clearTimeout(
|
|
952
|
+
return () => clearTimeout(l);
|
|
944
953
|
}
|
|
945
|
-
}, [d,
|
|
946
|
-
if (!d ||
|
|
954
|
+
}, [d, he]), se(() => {
|
|
955
|
+
if (!d || c.length === 0 || X.current)
|
|
947
956
|
return;
|
|
948
|
-
const
|
|
949
|
-
if (
|
|
957
|
+
const l = t === "horizontal" ? p.width : p.height;
|
|
958
|
+
if (l <= 0)
|
|
950
959
|
return;
|
|
951
960
|
const g = Lt(d);
|
|
952
|
-
if (g && g.length ===
|
|
953
|
-
const
|
|
954
|
-
const
|
|
961
|
+
if (g && g.length === c.length) {
|
|
962
|
+
const w = c.map((M, A) => {
|
|
963
|
+
const B = te(M.minSize, 0, l), H = te(M.maxSize, l, l), Z = me(g[A], B, H), T = Ce(Z, l), R = M.sizeUnit === "pixels" || M.originalPixelSize !== void 0 ? Z : M.preferredPixelSize;
|
|
955
964
|
return {
|
|
956
|
-
...
|
|
957
|
-
size:
|
|
958
|
-
percentageSize:
|
|
959
|
-
preferredPercentageSize:
|
|
960
|
-
preferredPixelSize:
|
|
965
|
+
...M,
|
|
966
|
+
size: Z,
|
|
967
|
+
percentageSize: T,
|
|
968
|
+
preferredPercentageSize: T > 0 ? T : M.preferredPercentageSize,
|
|
969
|
+
preferredPixelSize: R
|
|
961
970
|
};
|
|
962
971
|
});
|
|
963
|
-
i({ type: "SET_PANELS", panels:
|
|
972
|
+
i({ type: "SET_PANELS", panels: w }), X.current = !0;
|
|
964
973
|
}
|
|
965
|
-
}, [d,
|
|
966
|
-
const
|
|
967
|
-
const g =
|
|
968
|
-
id:
|
|
969
|
-
size:
|
|
970
|
-
percentageSize:
|
|
971
|
-
preferredPercentageSize:
|
|
972
|
-
preferredPixelSize:
|
|
973
|
-
sizeUnit:
|
|
974
|
-
originalPixelSize:
|
|
975
|
-
minSize:
|
|
976
|
-
maxSize:
|
|
977
|
-
collapseFromStart:
|
|
978
|
-
collapseFromEnd:
|
|
979
|
-
collapsed:
|
|
980
|
-
collapsedByDirection:
|
|
981
|
-
sizeBeforeCollapse:
|
|
982
|
-
percentageSizeBeforeCollapse:
|
|
983
|
-
preferredPercentageSizeBeforeCollapse:
|
|
984
|
-
preferredPixelSizeBeforeCollapse:
|
|
985
|
-
pixelAdjustPriority:
|
|
974
|
+
}, [d, c, p.width, p.height, t]);
|
|
975
|
+
const ue = Se((l) => {
|
|
976
|
+
const g = j.current, w = oe.current, M = JSON.stringify({
|
|
977
|
+
id: l.id,
|
|
978
|
+
size: l.size ?? null,
|
|
979
|
+
percentageSize: l.percentageSize ?? null,
|
|
980
|
+
preferredPercentageSize: l.preferredPercentageSize ?? null,
|
|
981
|
+
preferredPixelSize: l.preferredPixelSize ?? null,
|
|
982
|
+
sizeUnit: l.sizeUnit,
|
|
983
|
+
originalPixelSize: l.originalPixelSize ?? null,
|
|
984
|
+
minSize: l.minSize ?? null,
|
|
985
|
+
maxSize: l.maxSize ?? null,
|
|
986
|
+
collapseFromStart: l.collapseFromStart,
|
|
987
|
+
collapseFromEnd: l.collapseFromEnd,
|
|
988
|
+
collapsed: l.collapsed ?? !1,
|
|
989
|
+
collapsedByDirection: l.collapsedByDirection ?? null,
|
|
990
|
+
sizeBeforeCollapse: l.sizeBeforeCollapse ?? null,
|
|
991
|
+
percentageSizeBeforeCollapse: l.percentageSizeBeforeCollapse ?? null,
|
|
992
|
+
preferredPercentageSizeBeforeCollapse: l.preferredPercentageSizeBeforeCollapse ?? null,
|
|
993
|
+
preferredPixelSizeBeforeCollapse: l.preferredPixelSizeBeforeCollapse ?? null,
|
|
994
|
+
pixelAdjustPriority: l.pixelAdjustPriority ?? null
|
|
986
995
|
});
|
|
987
|
-
if (
|
|
988
|
-
|
|
989
|
-
panelId:
|
|
996
|
+
if (w[l.id] === M) {
|
|
997
|
+
Ue.debug("useResizablePanels.registerPanel skipped", {
|
|
998
|
+
panelId: l.id,
|
|
990
999
|
reason: "duplicate-registration"
|
|
991
1000
|
});
|
|
992
1001
|
return;
|
|
993
1002
|
}
|
|
994
|
-
|
|
995
|
-
panelId:
|
|
996
|
-
containerReady:
|
|
997
|
-
violationReason:
|
|
1003
|
+
w[l.id] = M, Ue.debug("useResizablePanels.registerPanel", {
|
|
1004
|
+
panelId: l.id,
|
|
1005
|
+
containerReady: _.current,
|
|
1006
|
+
violationReason: E.current,
|
|
998
1007
|
containerSize: {
|
|
999
1008
|
width: g.width,
|
|
1000
1009
|
height: g.height
|
|
1001
1010
|
}
|
|
1002
|
-
}), i({ type: "REGISTER_PANEL", panel:
|
|
1003
|
-
}, []),
|
|
1004
|
-
const g =
|
|
1005
|
-
|
|
1006
|
-
panelId:
|
|
1007
|
-
containerReady:
|
|
1008
|
-
violationReason:
|
|
1011
|
+
}), i({ type: "REGISTER_PANEL", panel: l });
|
|
1012
|
+
}, []), pe = Se((l) => {
|
|
1013
|
+
const g = j.current;
|
|
1014
|
+
Ue.debug("useResizablePanels.unregisterPanel", {
|
|
1015
|
+
panelId: l,
|
|
1016
|
+
containerReady: _.current,
|
|
1017
|
+
violationReason: E.current,
|
|
1009
1018
|
containerSize: {
|
|
1010
1019
|
width: g.width,
|
|
1011
1020
|
height: g.height
|
|
1012
1021
|
}
|
|
1013
|
-
}), i({ type: "UNREGISTER_PANEL", id:
|
|
1014
|
-
if (!(
|
|
1015
|
-
return
|
|
1016
|
-
const
|
|
1017
|
-
return delete
|
|
1022
|
+
}), i({ type: "UNREGISTER_PANEL", id: l }), delete oe.current[l], v((w) => {
|
|
1023
|
+
if (!(l in w))
|
|
1024
|
+
return w;
|
|
1025
|
+
const M = { ...w };
|
|
1026
|
+
return delete M[l], M;
|
|
1018
1027
|
});
|
|
1019
|
-
}, []),
|
|
1020
|
-
(
|
|
1021
|
-
const
|
|
1022
|
-
if (!(
|
|
1023
|
-
i({ type: "RESIZE_PANELS", leftId:
|
|
1028
|
+
}, []), ge = Se(
|
|
1029
|
+
(l, g, w, M) => {
|
|
1030
|
+
const A = t === "horizontal" ? p.width : p.height, B = c.find((W) => W.id === l), H = c.find((W) => W.id === g);
|
|
1031
|
+
if (!(B && H)) {
|
|
1032
|
+
i({ type: "RESIZE_PANELS", leftId: l, rightId: g, leftSize: w, rightSize: M, containerSize: A });
|
|
1024
1033
|
return;
|
|
1025
1034
|
}
|
|
1026
|
-
if (
|
|
1035
|
+
if (B.collapsed || H.collapsed)
|
|
1027
1036
|
return;
|
|
1028
|
-
const
|
|
1029
|
-
let
|
|
1030
|
-
const
|
|
1031
|
-
if (K
|
|
1032
|
-
const
|
|
1033
|
-
if (
|
|
1034
|
-
const
|
|
1035
|
-
if (
|
|
1036
|
-
const
|
|
1037
|
-
|
|
1037
|
+
const Z = te(B.minSize, 0, A), T = te(B.maxSize, A, A), R = te(H.minSize, 0, A), F = te(H.maxSize, A, A);
|
|
1038
|
+
let k = me(w, Z, T), Q = me(M, R, F);
|
|
1039
|
+
const ne = k + Q, K = w + M;
|
|
1040
|
+
if (Math.abs(ne - K) > 1e-9) {
|
|
1041
|
+
const W = K - ne;
|
|
1042
|
+
if (W > 0) {
|
|
1043
|
+
const q = T - k, f = F - Q, L = q + f;
|
|
1044
|
+
if (L > 0) {
|
|
1045
|
+
const ee = Math.min(W * (q / L), q), ie = Math.min(W - ee, f);
|
|
1046
|
+
k += ee, Q += ie;
|
|
1038
1047
|
}
|
|
1039
|
-
} else if (
|
|
1040
|
-
const
|
|
1041
|
-
if (
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1048
|
+
} else if (W < 0) {
|
|
1049
|
+
const q = Math.abs(W), f = k - Z, L = Q - R, ee = f + L;
|
|
1050
|
+
if (ee > 0) {
|
|
1051
|
+
const ie = Math.min(q * (f / ee), f), xe = Math.min(q - ie, L);
|
|
1052
|
+
k -= ie, Q -= xe;
|
|
1044
1053
|
}
|
|
1045
1054
|
}
|
|
1046
1055
|
}
|
|
1047
|
-
|
|
1056
|
+
k = me(k, Z, T), Q = me(Q, R, F), Math.abs(k + Q - K) > 1e-9 && Ue.error("Total size after constraints should be close to the original total size.", { constrainedLeftSize: k, constrainedRightSize: Q, originalTotalSize: K }), i({ type: "RESIZE_PANELS", leftId: l, rightId: g, leftSize: k, rightSize: Q, containerSize: A });
|
|
1048
1057
|
},
|
|
1049
|
-
[t,
|
|
1050
|
-
),
|
|
1051
|
-
(
|
|
1052
|
-
const
|
|
1053
|
-
i({ type: "COLLAPSE_PANEL", id:
|
|
1058
|
+
[t, p.width, p.height, c]
|
|
1059
|
+
), ye = Se(
|
|
1060
|
+
(l, g) => {
|
|
1061
|
+
const w = t === "horizontal" ? p.width : p.height;
|
|
1062
|
+
i({ type: "COLLAPSE_PANEL", id: l, from: g, containerSize: w });
|
|
1054
1063
|
},
|
|
1055
|
-
[t,
|
|
1056
|
-
),
|
|
1057
|
-
(
|
|
1058
|
-
const
|
|
1059
|
-
i({ type: "EXPAND_PANEL", id:
|
|
1064
|
+
[t, p.width, p.height]
|
|
1065
|
+
), Be = Se(
|
|
1066
|
+
(l, g, w) => {
|
|
1067
|
+
const M = t === "horizontal" ? p.width : p.height;
|
|
1068
|
+
i({ type: "EXPAND_PANEL", id: l, from: g, containerSize: M, targetSize: w });
|
|
1060
1069
|
},
|
|
1061
|
-
[t,
|
|
1062
|
-
),
|
|
1063
|
-
(
|
|
1064
|
-
[
|
|
1065
|
-
),
|
|
1066
|
-
v((
|
|
1070
|
+
[t, p.width, p.height]
|
|
1071
|
+
), Re = Se(
|
|
1072
|
+
(l) => c.find((g) => g.id === l),
|
|
1073
|
+
[c]
|
|
1074
|
+
), G = Se((l, g) => {
|
|
1075
|
+
v((w) => {
|
|
1067
1076
|
if (g === null) {
|
|
1068
|
-
if (!(
|
|
1069
|
-
return
|
|
1070
|
-
const
|
|
1071
|
-
return delete
|
|
1077
|
+
if (!(l in w))
|
|
1078
|
+
return w;
|
|
1079
|
+
const H = { ...w };
|
|
1080
|
+
return delete H[l], H;
|
|
1072
1081
|
}
|
|
1073
|
-
const
|
|
1074
|
-
return
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1082
|
+
const M = w[l], A = M && Math.abs(M.pixelSize - g.pixelSize) < 0.1, B = M && Math.abs(M.percentageSize - g.percentageSize) < 0.01;
|
|
1083
|
+
return A && B ? (N.current[l] && clearTimeout(N.current[l]), be.current[l] = g, N.current[l] = setTimeout(() => {
|
|
1084
|
+
const H = be.current[l];
|
|
1085
|
+
H && v((Z) => ({
|
|
1086
|
+
...Z,
|
|
1087
|
+
[l]: H
|
|
1088
|
+
})), delete N.current[l];
|
|
1089
|
+
}, 200), w) : (N.current[l] && (clearTimeout(N.current[l]), delete N.current[l]), {
|
|
1090
|
+
...w,
|
|
1091
|
+
[l]: g
|
|
1092
|
+
});
|
|
1078
1093
|
});
|
|
1079
|
-
}, []),
|
|
1080
|
-
|
|
1094
|
+
}, []), le = Se((l, g) => {
|
|
1095
|
+
C((w) => {
|
|
1081
1096
|
if (g === null) {
|
|
1082
|
-
if (!(
|
|
1083
|
-
return
|
|
1084
|
-
const
|
|
1085
|
-
return delete
|
|
1097
|
+
if (!(l in w))
|
|
1098
|
+
return w;
|
|
1099
|
+
const A = { ...w };
|
|
1100
|
+
return delete A[l], A;
|
|
1086
1101
|
}
|
|
1087
|
-
const
|
|
1088
|
-
return
|
|
1089
|
-
...
|
|
1090
|
-
[
|
|
1102
|
+
const M = w[l];
|
|
1103
|
+
return M && Math.abs(M.thickness - g.thickness) <= 0.25 && M.visible === g.visible && M.direction === g.direction && M.startPanelId === g.startPanelId && M.endPanelId === g.endPanelId ? w : {
|
|
1104
|
+
...w,
|
|
1105
|
+
[l]: g
|
|
1091
1106
|
};
|
|
1092
1107
|
});
|
|
1093
|
-
}, []),
|
|
1108
|
+
}, []), P = ae(
|
|
1094
1109
|
() => ({
|
|
1095
1110
|
direction: t,
|
|
1096
|
-
panels:
|
|
1097
|
-
containerSize:
|
|
1111
|
+
panels: c,
|
|
1112
|
+
containerSize: p,
|
|
1098
1113
|
isContainerReady: z,
|
|
1099
1114
|
showDebugInfo: r,
|
|
1100
|
-
registerPanel:
|
|
1101
|
-
unregisterPanel:
|
|
1102
|
-
resizePanels:
|
|
1103
|
-
collapsePanel:
|
|
1104
|
-
expandPanel:
|
|
1105
|
-
getPanel:
|
|
1106
|
-
reportPanelMeasurement:
|
|
1107
|
-
panelMeasurements:
|
|
1108
|
-
reportHandleMeasurement:
|
|
1109
|
-
handleMeasurements:
|
|
1110
|
-
layoutConstraintViolation:
|
|
1115
|
+
registerPanel: ue,
|
|
1116
|
+
unregisterPanel: pe,
|
|
1117
|
+
resizePanels: ge,
|
|
1118
|
+
collapsePanel: ye,
|
|
1119
|
+
expandPanel: Be,
|
|
1120
|
+
getPanel: Re,
|
|
1121
|
+
reportPanelMeasurement: G,
|
|
1122
|
+
panelMeasurements: m,
|
|
1123
|
+
reportHandleMeasurement: le,
|
|
1124
|
+
handleMeasurements: x,
|
|
1125
|
+
layoutConstraintViolation: h
|
|
1111
1126
|
}),
|
|
1112
|
-
[t,
|
|
1113
|
-
),
|
|
1127
|
+
[t, c, p, z, r, ue, pe, ge, ye, Be, Re, G, m, le, x, h]
|
|
1128
|
+
), $ = ae(
|
|
1114
1129
|
() => ({
|
|
1115
1130
|
display: "flex",
|
|
1116
1131
|
flexDirection: t === "horizontal" ? "row" : "column",
|
|
@@ -1127,59 +1142,59 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
1127
1142
|
[t, e]
|
|
1128
1143
|
);
|
|
1129
1144
|
return {
|
|
1130
|
-
groupRef:
|
|
1131
|
-
contextValue:
|
|
1132
|
-
groupStyle:
|
|
1145
|
+
groupRef: S,
|
|
1146
|
+
contextValue: P,
|
|
1147
|
+
groupStyle: $
|
|
1133
1148
|
};
|
|
1134
1149
|
}, di = (t) => {
|
|
1135
|
-
const { getPanel: e, collapsePanel: n, expandPanel: d } =
|
|
1150
|
+
const { getPanel: e, collapsePanel: n, expandPanel: d } = rt(), r = e(t), c = Se(
|
|
1136
1151
|
(u) => {
|
|
1137
1152
|
n(t, u);
|
|
1138
1153
|
},
|
|
1139
1154
|
[n, t]
|
|
1140
|
-
), i =
|
|
1155
|
+
), i = Se(
|
|
1141
1156
|
(u, z) => {
|
|
1142
1157
|
d(t, u, z);
|
|
1143
1158
|
},
|
|
1144
1159
|
[d, t]
|
|
1145
|
-
),
|
|
1160
|
+
), p = Se(
|
|
1146
1161
|
(u, z) => {
|
|
1147
|
-
r?.collapsed ? i(u, z) :
|
|
1162
|
+
r?.collapsed ? i(u, z) : c(u);
|
|
1148
1163
|
},
|
|
1149
|
-
[r?.collapsed,
|
|
1164
|
+
[r?.collapsed, c, i]
|
|
1150
1165
|
);
|
|
1151
|
-
return
|
|
1166
|
+
return ae(
|
|
1152
1167
|
() => ({
|
|
1153
1168
|
panel: r,
|
|
1154
1169
|
isCollapsed: r?.collapsed ?? !1,
|
|
1155
1170
|
canCollapseFromStart: r?.collapseFromStart ?? !1,
|
|
1156
1171
|
canCollapseFromEnd: r?.collapseFromEnd ?? !1,
|
|
1157
|
-
collapse:
|
|
1172
|
+
collapse: c,
|
|
1158
1173
|
expand: i,
|
|
1159
|
-
toggle:
|
|
1174
|
+
toggle: p
|
|
1160
1175
|
}),
|
|
1161
|
-
[r,
|
|
1176
|
+
[r, c, i, p]
|
|
1162
1177
|
);
|
|
1163
|
-
},
|
|
1164
|
-
const
|
|
1178
|
+
}, Tt = ({ panel: t, measuredPixelSize: e, measuredPercentageSize: n, containerAxisSize: d, containerLabel: r }) => {
|
|
1179
|
+
const c = t?.size, i = typeof c == "number" && Number.isFinite(c) ? `${c.toFixed(3)}px` : "-", p = t?.percentageSize !== void 0 ? `${t.percentageSize.toFixed(3)}%` : "-", u = Number.isFinite(e) ? `${e.toFixed(3)}px` : "-", z = Number.isFinite(n) ? `${n.toFixed(3)}%` : "-", s = Number.isFinite(d) ? `${d.toFixed(3)}px` : "-", a = `${i} / ${p}`, o = `${u} / ${z}`, h = t?.sizeUnit === "pixels" ? "Fixed" : "Flexible", b = [h, `${r}: ${s}`, `size (state): ${a}`, `size (measured): ${o}`];
|
|
1165
1180
|
return {
|
|
1166
1181
|
stateValueDisplay: a,
|
|
1167
1182
|
measuredValueDisplay: o,
|
|
1168
1183
|
containerDisplay: s,
|
|
1169
|
-
headlineLabel:
|
|
1170
|
-
titleText:
|
|
1184
|
+
headlineLabel: h,
|
|
1185
|
+
titleText: b.join(`
|
|
1171
1186
|
`)
|
|
1172
1187
|
};
|
|
1173
|
-
},
|
|
1174
|
-
const
|
|
1175
|
-
() =>
|
|
1188
|
+
}, _t = it(({ panel: t, measuredPixelSize: e, measuredPercentageSize: n, containerAxisSize: d, direction: r }) => {
|
|
1189
|
+
const c = r === "horizontal" ? "container width" : "container height", { stateValueDisplay: i, measuredValueDisplay: p, containerDisplay: u, headlineLabel: z, titleText: s } = ae(
|
|
1190
|
+
() => Tt({
|
|
1176
1191
|
panel: t,
|
|
1177
1192
|
measuredPixelSize: e,
|
|
1178
1193
|
measuredPercentageSize: n,
|
|
1179
1194
|
containerAxisSize: d,
|
|
1180
|
-
containerLabel:
|
|
1195
|
+
containerLabel: c
|
|
1181
1196
|
}),
|
|
1182
|
-
[t, e, n, d,
|
|
1197
|
+
[t, e, n, d, c]
|
|
1183
1198
|
), a = {
|
|
1184
1199
|
position: "absolute",
|
|
1185
1200
|
top: "2px",
|
|
@@ -1204,7 +1219,7 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
1204
1219
|
gap: "1px",
|
|
1205
1220
|
minWidth: "0",
|
|
1206
1221
|
width: "100%"
|
|
1207
|
-
},
|
|
1222
|
+
}, h = {
|
|
1208
1223
|
display: "flex",
|
|
1209
1224
|
justifyContent: "flex-start",
|
|
1210
1225
|
alignItems: "center",
|
|
@@ -1216,7 +1231,7 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
1216
1231
|
textOverflow: "ellipsis",
|
|
1217
1232
|
minWidth: "0",
|
|
1218
1233
|
width: "100%"
|
|
1219
|
-
},
|
|
1234
|
+
}, b = {
|
|
1220
1235
|
display: "flex",
|
|
1221
1236
|
justifyContent: "space-between",
|
|
1222
1237
|
alignItems: "center",
|
|
@@ -1226,27 +1241,27 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
1226
1241
|
textOverflow: "ellipsis",
|
|
1227
1242
|
minWidth: "0",
|
|
1228
1243
|
width: "100%"
|
|
1229
|
-
},
|
|
1244
|
+
}, m = {
|
|
1230
1245
|
marginLeft: "auto",
|
|
1231
1246
|
fontVariantNumeric: "tabular-nums",
|
|
1232
1247
|
whiteSpace: "nowrap"
|
|
1233
1248
|
};
|
|
1234
|
-
return /* @__PURE__ */
|
|
1235
|
-
/* @__PURE__ */
|
|
1236
|
-
/* @__PURE__ */
|
|
1237
|
-
/* @__PURE__ */
|
|
1238
|
-
/* @__PURE__ */
|
|
1249
|
+
return /* @__PURE__ */ I("div", { style: a, title: s, children: /* @__PURE__ */ fe("div", { style: o, children: [
|
|
1250
|
+
/* @__PURE__ */ I("div", { style: h, children: /* @__PURE__ */ I("span", { children: z }) }),
|
|
1251
|
+
/* @__PURE__ */ fe("div", { style: b, children: [
|
|
1252
|
+
/* @__PURE__ */ I("span", { children: c }),
|
|
1253
|
+
/* @__PURE__ */ I("span", { style: m, children: u })
|
|
1239
1254
|
] }),
|
|
1240
|
-
/* @__PURE__ */
|
|
1241
|
-
/* @__PURE__ */
|
|
1242
|
-
/* @__PURE__ */
|
|
1255
|
+
/* @__PURE__ */ fe("div", { style: b, children: [
|
|
1256
|
+
/* @__PURE__ */ I("span", { children: "size (state)" }),
|
|
1257
|
+
/* @__PURE__ */ I("span", { style: m, children: i })
|
|
1243
1258
|
] }),
|
|
1244
|
-
/* @__PURE__ */
|
|
1245
|
-
/* @__PURE__ */
|
|
1246
|
-
/* @__PURE__ */
|
|
1259
|
+
/* @__PURE__ */ fe("div", { style: b, children: [
|
|
1260
|
+
/* @__PURE__ */ I("span", { children: "size (measured)" }),
|
|
1261
|
+
/* @__PURE__ */ I("span", { style: m, children: p })
|
|
1247
1262
|
] })
|
|
1248
1263
|
] }) });
|
|
1249
|
-
}),
|
|
1264
|
+
}), tt = new je(qe.INFO, "[resize-panels]"), kt = {
|
|
1250
1265
|
both: {
|
|
1251
1266
|
collapseFromStart: !0,
|
|
1252
1267
|
collapseFromEnd: !0
|
|
@@ -1269,175 +1284,181 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
1269
1284
|
if (!e)
|
|
1270
1285
|
throw new Error("Invalid collapsible configuration: unsupported 'from' value");
|
|
1271
1286
|
return e;
|
|
1272
|
-
},
|
|
1273
|
-
if (!Number.isFinite(
|
|
1287
|
+
}, lt = ({ ref: t, setState: e, panelIdRef: n, label: d, timerRef: r }) => (c) => {
|
|
1288
|
+
if (!Number.isFinite(c))
|
|
1289
|
+
return;
|
|
1290
|
+
const i = c < 0 ? 0 : c, p = d === "pixel" ? 0.1 : 0.01;
|
|
1291
|
+
if (Math.abs(t.current - i) < p) {
|
|
1292
|
+
r && (r.current && clearTimeout(r.current), r.current = setTimeout(() => {
|
|
1293
|
+
t.current = i, e(i), r.current = null;
|
|
1294
|
+
}, 200));
|
|
1274
1295
|
return;
|
|
1275
|
-
|
|
1276
|
-
|
|
1296
|
+
}
|
|
1297
|
+
r?.current && (clearTimeout(r.current), r.current = null), t.current = i, tt.debug(`commit ${d}`, {
|
|
1277
1298
|
panelId: n.current,
|
|
1278
|
-
[d]:
|
|
1279
|
-
}), e(
|
|
1280
|
-
}, ui =
|
|
1281
|
-
({ id: t, defaultSize: e = { value: 50, unit: "percentage" }, minSize: n, maxSize: d, autoMinSize: r, className:
|
|
1282
|
-
const { direction:
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
const
|
|
1287
|
-
() =>
|
|
1288
|
-
ref:
|
|
1289
|
-
setState:
|
|
1290
|
-
panelIdRef:
|
|
1291
|
-
label: "pixel"
|
|
1299
|
+
[d]: i
|
|
1300
|
+
}), e(i);
|
|
1301
|
+
}, ui = it(
|
|
1302
|
+
({ id: t, defaultSize: e = { value: 50, unit: "percentage" }, minSize: n, maxSize: d, autoMinSize: r, className: c, style: i, children: p, order: u = 0, collapsible: z, defaultCollapsed: s = !1, pixelAdjustPriority: a, flexAdjustPriority: o, contentOverflow: h = "auto" }) => {
|
|
1303
|
+
const { direction: b, registerPanel: m, unregisterPanel: v, getPanel: x, showDebugInfo: C, isContainerReady: S, reportPanelMeasurement: D, containerSize: X } = rt(), re = J(null), de = zt(), j = J(t || `panel-${de}`), _ = ae(() => Gt(z), [z]), E = _.collapseFromStart || _.collapseFromEnd, oe = ae(() => E ? _.collapseFromStart ? "start" : _.collapseFromEnd ? "end" : null : null, [E, _.collapseFromStart, _.collapseFromEnd]), U = E && s, V = ae(() => Qe(e), [e]), O = V?.unit === "pixels", Y = O ? void 0 : V?.value, y = x(j.current), N = !!y?.collapsed, be = (y?.size ?? 0) <= 0, ce = N || be, [Pe, he] = Me(() => O && V ? V.value : y?.size !== void 0 ? y.size : 0), [ue, pe] = Me(() => !O && V ? V.value : y?.percentageSize !== void 0 ? y.percentageSize : 0), ge = J(Pe), ye = J(ue), Be = J(null), Re = J(null);
|
|
1304
|
+
se(() => () => {
|
|
1305
|
+
Be.current && clearTimeout(Be.current), Re.current && clearTimeout(Re.current);
|
|
1306
|
+
}, []);
|
|
1307
|
+
const G = ae(
|
|
1308
|
+
() => lt({
|
|
1309
|
+
ref: ge,
|
|
1310
|
+
setState: he,
|
|
1311
|
+
panelIdRef: j,
|
|
1312
|
+
label: "pixel",
|
|
1313
|
+
timerRef: Be
|
|
1292
1314
|
}),
|
|
1293
1315
|
[]
|
|
1294
|
-
),
|
|
1295
|
-
() =>
|
|
1296
|
-
ref:
|
|
1297
|
-
setState:
|
|
1298
|
-
panelIdRef:
|
|
1299
|
-
label: "percentage"
|
|
1316
|
+
), le = ae(
|
|
1317
|
+
() => lt({
|
|
1318
|
+
ref: ye,
|
|
1319
|
+
setState: pe,
|
|
1320
|
+
panelIdRef: j,
|
|
1321
|
+
label: "percentage",
|
|
1322
|
+
timerRef: Re
|
|
1300
1323
|
}),
|
|
1301
1324
|
[]
|
|
1302
|
-
),
|
|
1303
|
-
|
|
1325
|
+
), P = Se(() => {
|
|
1326
|
+
ge.current !== 0 && (ge.current = 0, he(0)), ye.current !== 0 && (ye.current = 0, pe(0));
|
|
1304
1327
|
}, []);
|
|
1305
|
-
|
|
1306
|
-
if (!
|
|
1328
|
+
se(() => {
|
|
1329
|
+
if (!S)
|
|
1307
1330
|
return;
|
|
1308
|
-
let
|
|
1309
|
-
if (
|
|
1310
|
-
let
|
|
1311
|
-
n && typeof n == "object" && n.unit === "pixels" && (
|
|
1331
|
+
let T = 0;
|
|
1332
|
+
if (O && V) {
|
|
1333
|
+
let q = V.value;
|
|
1334
|
+
n && typeof n == "object" && n.unit === "pixels" && (q = Math.max(q, n.value)), d && typeof d == "object" && d.unit === "pixels" && (q = Math.min(q, d.value)), T = q;
|
|
1312
1335
|
}
|
|
1313
|
-
const
|
|
1314
|
-
s && !
|
|
1315
|
-
const
|
|
1316
|
-
id:
|
|
1317
|
-
size:
|
|
1318
|
-
percentageSize:
|
|
1319
|
-
preferredPercentageSize:
|
|
1320
|
-
preferredPixelSize:
|
|
1321
|
-
sizeUnit:
|
|
1322
|
-
originalPixelSize:
|
|
1336
|
+
const R = U, F = R ? oe : null;
|
|
1337
|
+
s && !E && tt.warn("Panel defaultCollapsed is ignored because collapsible configuration is not provided.");
|
|
1338
|
+
const k = E && R && O ? T : void 0, Q = E ? Y : void 0, ne = O ? T : void 0, K = {
|
|
1339
|
+
id: j.current,
|
|
1340
|
+
size: R ? 0 : T,
|
|
1341
|
+
percentageSize: R ? 0 : Y,
|
|
1342
|
+
preferredPercentageSize: Y,
|
|
1343
|
+
preferredPixelSize: ne,
|
|
1344
|
+
sizeUnit: V?.unit || "percentage",
|
|
1345
|
+
originalPixelSize: O ? T : void 0,
|
|
1323
1346
|
minSize: n,
|
|
1324
1347
|
maxSize: d,
|
|
1325
|
-
collapseFromStart:
|
|
1326
|
-
collapseFromEnd:
|
|
1327
|
-
collapsedByDirection:
|
|
1328
|
-
collapsed:
|
|
1329
|
-
sizeBeforeCollapse:
|
|
1330
|
-
percentageSizeBeforeCollapse:
|
|
1331
|
-
preferredPercentageSizeBeforeCollapse:
|
|
1332
|
-
preferredPixelSizeBeforeCollapse:
|
|
1348
|
+
collapseFromStart: _.collapseFromStart,
|
|
1349
|
+
collapseFromEnd: _.collapseFromEnd,
|
|
1350
|
+
collapsedByDirection: F,
|
|
1351
|
+
collapsed: R,
|
|
1352
|
+
sizeBeforeCollapse: k,
|
|
1353
|
+
percentageSizeBeforeCollapse: Q,
|
|
1354
|
+
preferredPercentageSizeBeforeCollapse: E ? Y : void 0,
|
|
1355
|
+
preferredPixelSizeBeforeCollapse: E ? ne : void 0,
|
|
1333
1356
|
pixelAdjustPriority: a,
|
|
1334
1357
|
flexAdjustPriority: o,
|
|
1335
1358
|
autoMinSize: r
|
|
1336
1359
|
};
|
|
1337
|
-
|
|
1338
|
-
v(W.current), D(W.current, null);
|
|
1339
|
-
};
|
|
1360
|
+
m(K);
|
|
1340
1361
|
}, [
|
|
1341
1362
|
r,
|
|
1342
|
-
|
|
1343
|
-
|
|
1363
|
+
_.collapseFromEnd,
|
|
1364
|
+
_.collapseFromStart,
|
|
1344
1365
|
s,
|
|
1345
|
-
|
|
1366
|
+
V,
|
|
1346
1367
|
o,
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1368
|
+
E,
|
|
1369
|
+
S,
|
|
1370
|
+
O,
|
|
1350
1371
|
d,
|
|
1351
1372
|
n,
|
|
1352
1373
|
a,
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
v
|
|
1359
|
-
]);
|
|
1360
|
-
const
|
|
1361
|
-
|
|
1362
|
-
const
|
|
1363
|
-
if (!
|
|
1364
|
-
const
|
|
1365
|
-
if (!
|
|
1374
|
+
oe,
|
|
1375
|
+
Y,
|
|
1376
|
+
m,
|
|
1377
|
+
U
|
|
1378
|
+
]), se(() => () => {
|
|
1379
|
+
v(j.current), D(j.current, null);
|
|
1380
|
+
}, [v, D]);
|
|
1381
|
+
const $ = y?.size ?? 0;
|
|
1382
|
+
se(() => {
|
|
1383
|
+
const T = re.current;
|
|
1384
|
+
if (!T) return;
|
|
1385
|
+
const R = () => {
|
|
1386
|
+
if (!y)
|
|
1366
1387
|
return;
|
|
1367
|
-
const
|
|
1368
|
-
if (!
|
|
1369
|
-
const
|
|
1388
|
+
const K = T.parentElement;
|
|
1389
|
+
if (!K) return;
|
|
1390
|
+
const W = T.getBoundingClientRect(), q = Oe(K, "horizontal"), f = Oe(K, "vertical"), L = b === "horizontal" ? W.width : W.height, ee = b === "horizontal" ? q.inner : f.inner, ie = et(ee);
|
|
1370
1391
|
if (ce) {
|
|
1371
|
-
|
|
1392
|
+
P();
|
|
1372
1393
|
return;
|
|
1373
1394
|
}
|
|
1374
|
-
const
|
|
1375
|
-
if (
|
|
1376
|
-
|
|
1377
|
-
panelId:
|
|
1378
|
-
expectedPanelSize:
|
|
1379
|
-
measured:
|
|
1380
|
-
noiseThreshold:
|
|
1395
|
+
const xe = y.size ?? 0, Ne = Math.max(2, ie * 0.5);
|
|
1396
|
+
if (xe > ie && L < Ne) {
|
|
1397
|
+
tt.debug("skip noisy measurement", {
|
|
1398
|
+
panelId: j.current,
|
|
1399
|
+
expectedPanelSize: xe,
|
|
1400
|
+
measured: L,
|
|
1401
|
+
noiseThreshold: Ne
|
|
1381
1402
|
});
|
|
1382
1403
|
return;
|
|
1383
1404
|
}
|
|
1384
|
-
if (
|
|
1385
|
-
|
|
1405
|
+
if (L > 0) {
|
|
1406
|
+
G(L), ee > 0 && le(L / ee * 100);
|
|
1386
1407
|
return;
|
|
1387
1408
|
}
|
|
1388
|
-
|
|
1389
|
-
},
|
|
1390
|
-
|
|
1409
|
+
y.size !== void 0 && G(y.size), y.percentageSize !== void 0 ? le(y.percentageSize) : y.sizeUnit === "pixels" && y.size !== void 0 && ee > 0 && le(y.size / ee * 100);
|
|
1410
|
+
}, F = new ResizeObserver(() => {
|
|
1411
|
+
R();
|
|
1391
1412
|
});
|
|
1392
|
-
|
|
1393
|
-
const
|
|
1413
|
+
F.observe(T), R();
|
|
1414
|
+
const k = [], Q = new MutationObserver(() => {
|
|
1394
1415
|
(() => {
|
|
1395
|
-
if (!
|
|
1396
|
-
const
|
|
1397
|
-
return (
|
|
1398
|
-
})() && setTimeout(
|
|
1399
|
-
}),
|
|
1400
|
-
return
|
|
1416
|
+
if (!re.current) return !1;
|
|
1417
|
+
const W = re.current.getBoundingClientRect();
|
|
1418
|
+
return (b === "horizontal" ? W.width : W.height) !== ge.current;
|
|
1419
|
+
})() && setTimeout(R, 0);
|
|
1420
|
+
}), ne = T.parentElement;
|
|
1421
|
+
return ne && Q.observe(ne, {
|
|
1401
1422
|
childList: !0,
|
|
1402
1423
|
subtree: !0,
|
|
1403
1424
|
attributes: !0,
|
|
1404
1425
|
attributeFilter: ["style", "class"]
|
|
1405
1426
|
}), () => {
|
|
1406
|
-
|
|
1407
|
-
for (const
|
|
1408
|
-
clearTimeout(
|
|
1427
|
+
F.disconnect(), Q.disconnect();
|
|
1428
|
+
for (const K of k)
|
|
1429
|
+
clearTimeout(K);
|
|
1409
1430
|
};
|
|
1410
|
-
}, [
|
|
1411
|
-
const
|
|
1412
|
-
|
|
1413
|
-
if (
|
|
1431
|
+
}, [le, G, y, b, ce, P]);
|
|
1432
|
+
const l = y?.size, g = y?.percentageSize, w = y?.sizeUnit;
|
|
1433
|
+
se(() => {
|
|
1434
|
+
if (y) {
|
|
1414
1435
|
if (ce) {
|
|
1415
|
-
|
|
1436
|
+
P();
|
|
1416
1437
|
return;
|
|
1417
1438
|
}
|
|
1418
|
-
if (
|
|
1419
|
-
|
|
1420
|
-
else if (
|
|
1421
|
-
const
|
|
1422
|
-
if (
|
|
1423
|
-
const { width:
|
|
1424
|
-
if (
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1439
|
+
if (l !== void 0 && G(l), g !== void 0)
|
|
1440
|
+
le(g);
|
|
1441
|
+
else if (w === "pixels" && l !== void 0) {
|
|
1442
|
+
const T = re.current, R = T?.parentElement;
|
|
1443
|
+
if (T && R) {
|
|
1444
|
+
const { width: F, height: k } = T.getBoundingClientRect(), Q = R.clientWidth, ne = R.clientHeight, K = b === "horizontal" ? F : k, W = b === "horizontal" ? Q : ne;
|
|
1445
|
+
if (K > 0 && W > 0) {
|
|
1446
|
+
const q = K / W * 100;
|
|
1447
|
+
le(q);
|
|
1427
1448
|
}
|
|
1428
1449
|
}
|
|
1429
1450
|
}
|
|
1430
1451
|
}
|
|
1431
|
-
}, [
|
|
1432
|
-
D(
|
|
1433
|
-
pixelSize:
|
|
1434
|
-
percentageSize:
|
|
1452
|
+
}, [le, G, y, g, l, w, b, ce, P]), se(() => {
|
|
1453
|
+
D(j.current, {
|
|
1454
|
+
pixelSize: Pe,
|
|
1455
|
+
percentageSize: ue
|
|
1435
1456
|
});
|
|
1436
|
-
}, [D,
|
|
1437
|
-
const
|
|
1438
|
-
flexBasis:
|
|
1457
|
+
}, [D, Pe, ue]);
|
|
1458
|
+
const M = () => ce ? "0px" : y?.originalPixelSize !== void 0 ? `${$}px` : y?.percentageSize !== void 0 ? `${y.percentageSize}%` : `${$}px`, A = y?.sizeUnit === "percentage" && !y?.collapsed ? 1 : 0, B = {
|
|
1459
|
+
flexBasis: M(),
|
|
1439
1460
|
flexGrow: 0,
|
|
1440
|
-
flexShrink:
|
|
1461
|
+
flexShrink: A,
|
|
1441
1462
|
overflow: "hidden",
|
|
1442
1463
|
position: "relative",
|
|
1443
1464
|
boxSizing: "border-box",
|
|
@@ -1445,12 +1466,12 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
1445
1466
|
minWidth: "0px",
|
|
1446
1467
|
...i
|
|
1447
1468
|
};
|
|
1448
|
-
|
|
1449
|
-
const
|
|
1469
|
+
b === "horizontal" ? (B.height = "100%", B.minWidth = 0) : (B.width = "100%", B.minHeight = 0), ce && (b === "horizontal" ? (B.width = "0px", B.minWidth = "0px") : (B.height = "0px", B.minHeight = "0px"), B.flexGrow = 0, B.flexShrink = 0, B.pointerEvents = "none", B.visibility = "hidden", N && (B.display = "none"));
|
|
1470
|
+
const H = b === "horizontal" ? X.width : X.height, Z = ae(
|
|
1450
1471
|
() => ({
|
|
1451
1472
|
position: "absolute",
|
|
1452
1473
|
inset: "0px",
|
|
1453
|
-
overflow:
|
|
1474
|
+
overflow: h,
|
|
1454
1475
|
display: "flex",
|
|
1455
1476
|
flexDirection: "column",
|
|
1456
1477
|
width: "100%",
|
|
@@ -1458,27 +1479,27 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
1458
1479
|
minWidth: "0px",
|
|
1459
1480
|
minHeight: "0px"
|
|
1460
1481
|
}),
|
|
1461
|
-
[
|
|
1482
|
+
[h]
|
|
1462
1483
|
);
|
|
1463
|
-
return /* @__PURE__ */
|
|
1484
|
+
return /* @__PURE__ */ fe(
|
|
1464
1485
|
"div",
|
|
1465
1486
|
{
|
|
1466
|
-
ref:
|
|
1467
|
-
className:
|
|
1468
|
-
style:
|
|
1469
|
-
"data-panel-id":
|
|
1470
|
-
"data-panel-size":
|
|
1471
|
-
"data-panel-size-unit":
|
|
1472
|
-
"data-panel-pixel-size":
|
|
1487
|
+
ref: re,
|
|
1488
|
+
className: $e("panel", c),
|
|
1489
|
+
style: B,
|
|
1490
|
+
"data-panel-id": j.current,
|
|
1491
|
+
"data-panel-size": $,
|
|
1492
|
+
"data-panel-size-unit": y?.sizeUnit || "percentage",
|
|
1493
|
+
"data-panel-pixel-size": y?.sizeUnit === "pixels" ? y?.originalPixelSize : null,
|
|
1473
1494
|
"data-panel-order": u,
|
|
1474
|
-
"data-panel-collapsible":
|
|
1475
|
-
"data-panel-collapse-start":
|
|
1476
|
-
"data-panel-collapse-end":
|
|
1477
|
-
"data-panel-collapsed":
|
|
1495
|
+
"data-panel-collapsible": E,
|
|
1496
|
+
"data-panel-collapse-start": _.collapseFromStart,
|
|
1497
|
+
"data-panel-collapse-end": _.collapseFromEnd,
|
|
1498
|
+
"data-panel-collapsed": y?.collapsed,
|
|
1478
1499
|
"aria-hidden": ce,
|
|
1479
1500
|
children: [
|
|
1480
|
-
/* @__PURE__ */
|
|
1481
|
-
|
|
1501
|
+
/* @__PURE__ */ I("div", { style: Z, children: p }),
|
|
1502
|
+
C && /* @__PURE__ */ I(_t, { panel: y, measuredPixelSize: Pe, measuredPercentageSize: ue, containerAxisSize: H, direction: b })
|
|
1482
1503
|
]
|
|
1483
1504
|
}
|
|
1484
1505
|
);
|
|
@@ -1519,104 +1540,104 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
|
|
|
1519
1540
|
}))
|
|
1520
1541
|
), Wt = () => {
|
|
1521
1542
|
const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set();
|
|
1522
|
-
let d = null, r = 0,
|
|
1543
|
+
let d = null, r = 0, c = !0, i = [], p = {
|
|
1523
1544
|
ownerId: null,
|
|
1524
1545
|
groups: i
|
|
1525
1546
|
};
|
|
1526
1547
|
const u = () => {
|
|
1527
|
-
for (const
|
|
1528
|
-
|
|
1548
|
+
for (const x of t)
|
|
1549
|
+
x();
|
|
1529
1550
|
}, z = () => {
|
|
1530
|
-
|
|
1551
|
+
c = !0, u();
|
|
1531
1552
|
}, s = () => {
|
|
1532
|
-
const
|
|
1533
|
-
if (
|
|
1553
|
+
const x = d;
|
|
1554
|
+
if (x && n.has(x))
|
|
1534
1555
|
return !1;
|
|
1535
1556
|
d = null;
|
|
1536
|
-
const
|
|
1537
|
-
return
|
|
1557
|
+
const C = n.values().next();
|
|
1558
|
+
return C.done || (d = C.value), x !== d;
|
|
1538
1559
|
};
|
|
1539
1560
|
return {
|
|
1540
|
-
subscribe: (
|
|
1541
|
-
t.delete(
|
|
1561
|
+
subscribe: (x) => (t.add(x), () => {
|
|
1562
|
+
t.delete(x);
|
|
1542
1563
|
}),
|
|
1543
|
-
getSnapshot: () => (s() && (
|
|
1564
|
+
getSnapshot: () => (s() && (c = !0), c && (i = Array.from(e.values()).sort((C, S) => C.index - S.index).map(({ serializedPanels: C, serializedHandles: S, ...D }) => D), p = {
|
|
1544
1565
|
ownerId: d,
|
|
1545
1566
|
groups: i
|
|
1546
|
-
},
|
|
1547
|
-
getOwnerId: () => (s() && (
|
|
1548
|
-
enableGroup: (
|
|
1549
|
-
const
|
|
1550
|
-
n.add(
|
|
1567
|
+
}, c = !1), p),
|
|
1568
|
+
getOwnerId: () => (s() && (c = !0), d),
|
|
1569
|
+
enableGroup: (x) => {
|
|
1570
|
+
const C = n.size;
|
|
1571
|
+
n.add(x), n.size !== C && s() && z();
|
|
1551
1572
|
},
|
|
1552
|
-
disableGroup: (
|
|
1553
|
-
n.delete(
|
|
1573
|
+
disableGroup: (x) => {
|
|
1574
|
+
n.delete(x) && s() && z();
|
|
1554
1575
|
},
|
|
1555
|
-
updateGroup: (
|
|
1556
|
-
const
|
|
1557
|
-
let
|
|
1558
|
-
if (!
|
|
1559
|
-
if (
|
|
1560
|
-
|
|
1576
|
+
updateGroup: (x, C) => {
|
|
1577
|
+
const S = e.get(x), D = S?.index ?? r++, X = Ht(C.panels), re = Ut(C.handles), de = S?.displayName !== C.displayName, j = S?.direction !== C.direction, _ = S ? S.containerSize.width !== C.containerSize.width || S.containerSize.height !== C.containerSize.height : !0;
|
|
1578
|
+
let E = S?.serializedPanels !== X;
|
|
1579
|
+
if (!E && S)
|
|
1580
|
+
if (S.panels.length !== C.panels.length)
|
|
1581
|
+
E = !0;
|
|
1561
1582
|
else
|
|
1562
|
-
for (let
|
|
1563
|
-
const
|
|
1564
|
-
if (!(
|
|
1565
|
-
|
|
1583
|
+
for (let Y = 0; Y < C.panels.length; Y += 1) {
|
|
1584
|
+
const y = S.panels[Y], N = C.panels[Y];
|
|
1585
|
+
if (!(y && N)) {
|
|
1586
|
+
E = !0;
|
|
1566
1587
|
break;
|
|
1567
1588
|
}
|
|
1568
|
-
if (
|
|
1569
|
-
|
|
1589
|
+
if (y.id !== N.id || y.size !== N.size || y.percentageSize !== N.percentageSize || y.collapsed !== N.collapsed || y.measuredPixelSize !== N.measuredPixelSize || y.measuredPercentageSize !== N.measuredPercentageSize) {
|
|
1590
|
+
E = !0;
|
|
1570
1591
|
break;
|
|
1571
1592
|
}
|
|
1572
1593
|
}
|
|
1573
|
-
let
|
|
1574
|
-
if (!
|
|
1575
|
-
if (
|
|
1576
|
-
|
|
1594
|
+
let oe = S?.serializedHandles !== re;
|
|
1595
|
+
if (!oe && S)
|
|
1596
|
+
if (S.handles.length !== C.handles.length)
|
|
1597
|
+
oe = !0;
|
|
1577
1598
|
else
|
|
1578
|
-
for (let
|
|
1579
|
-
const
|
|
1580
|
-
if (!(
|
|
1581
|
-
|
|
1599
|
+
for (let Y = 0; Y < C.handles.length; Y += 1) {
|
|
1600
|
+
const y = S.handles[Y], N = C.handles[Y];
|
|
1601
|
+
if (!(y && N)) {
|
|
1602
|
+
oe = !0;
|
|
1582
1603
|
break;
|
|
1583
1604
|
}
|
|
1584
|
-
if (
|
|
1585
|
-
|
|
1605
|
+
if (y.id !== N.id || y.thickness !== N.thickness || y.visible !== N.visible || y.direction !== N.direction || y.startPanelId !== N.startPanelId || y.endPanelId !== N.endPanelId) {
|
|
1606
|
+
oe = !0;
|
|
1586
1607
|
break;
|
|
1587
1608
|
}
|
|
1588
1609
|
}
|
|
1589
|
-
if (!
|
|
1610
|
+
if (!S && C.panels.length === 0 && C.handles.length === 0 || S && !de && !j && !_ && !E && !oe)
|
|
1590
1611
|
return;
|
|
1591
|
-
const
|
|
1592
|
-
e.set(
|
|
1593
|
-
groupId:
|
|
1594
|
-
displayName:
|
|
1595
|
-
direction:
|
|
1596
|
-
containerSize:
|
|
1597
|
-
panels:
|
|
1598
|
-
handles:
|
|
1612
|
+
const U = C.panels.map((Y) => ({ ...Y })), V = C.handles.map((Y) => ({ ...Y })), O = { ...C.containerSize };
|
|
1613
|
+
e.set(x, {
|
|
1614
|
+
groupId: x,
|
|
1615
|
+
displayName: C.displayName,
|
|
1616
|
+
direction: C.direction,
|
|
1617
|
+
containerSize: O,
|
|
1618
|
+
panels: U,
|
|
1619
|
+
handles: V,
|
|
1599
1620
|
index: D,
|
|
1600
1621
|
serializedPanels: X,
|
|
1601
|
-
serializedHandles:
|
|
1622
|
+
serializedHandles: re
|
|
1602
1623
|
}), z();
|
|
1603
1624
|
},
|
|
1604
|
-
removeGroup: (
|
|
1605
|
-
const
|
|
1606
|
-
(
|
|
1625
|
+
removeGroup: (x) => {
|
|
1626
|
+
const C = e.delete(x), S = n.delete(x), D = s();
|
|
1627
|
+
(C || S || D) && z();
|
|
1607
1628
|
}
|
|
1608
1629
|
};
|
|
1609
|
-
},
|
|
1610
|
-
|
|
1611
|
-
},
|
|
1612
|
-
|
|
1630
|
+
}, Fe = Wt(), $t = () => ht(Fe.subscribe, Fe.getOwnerId, Fe.getOwnerId), jt = () => ht(Fe.subscribe, Fe.getSnapshot, Fe.getSnapshot), Vt = (t) => {
|
|
1631
|
+
Fe.enableGroup(t);
|
|
1632
|
+
}, ct = (t) => {
|
|
1633
|
+
Fe.disableGroup(t);
|
|
1613
1634
|
}, Yt = (t, e) => {
|
|
1614
|
-
|
|
1615
|
-
},
|
|
1616
|
-
|
|
1635
|
+
Fe.updateGroup(t, e);
|
|
1636
|
+
}, dt = (t) => {
|
|
1637
|
+
Fe.removeGroup(t);
|
|
1617
1638
|
};
|
|
1618
|
-
let
|
|
1619
|
-
const Zt = () => (
|
|
1639
|
+
let ut = 0;
|
|
1640
|
+
const Zt = () => (ut += 1, `panel-group-${ut}`), _e = (t, e) => typeof t != "number" || !Number.isFinite(t) ? "—" : `${(t < 0 ? 0 : t).toFixed(8)}${e}`, Xt = {
|
|
1620
1641
|
position: "fixed",
|
|
1621
1642
|
left: "50%",
|
|
1622
1643
|
bottom: "20px",
|
|
@@ -1673,7 +1694,7 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
|
|
|
1673
1694
|
display: "flex",
|
|
1674
1695
|
flexDirection: "column",
|
|
1675
1696
|
gap: "4px"
|
|
1676
|
-
},
|
|
1697
|
+
}, ft = {
|
|
1677
1698
|
display: "flex",
|
|
1678
1699
|
justifyContent: "space-between",
|
|
1679
1700
|
alignItems: "center",
|
|
@@ -1694,95 +1715,95 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
|
|
|
1694
1715
|
}, ni = (t, e) => {
|
|
1695
1716
|
let n = !1;
|
|
1696
1717
|
const d = t.map((r) => {
|
|
1697
|
-
const
|
|
1698
|
-
return !
|
|
1718
|
+
const c = e[r.id];
|
|
1719
|
+
return !c || r.measuredPixelSize === c.pixelSize && r.measuredPercentageSize === c.percentageSize ? r : (n = !0, {
|
|
1699
1720
|
...r,
|
|
1700
|
-
measuredPixelSize:
|
|
1701
|
-
measuredPercentageSize:
|
|
1721
|
+
measuredPixelSize: c.pixelSize,
|
|
1722
|
+
measuredPercentageSize: c.percentageSize
|
|
1702
1723
|
});
|
|
1703
1724
|
});
|
|
1704
1725
|
return n ? d : t;
|
|
1705
|
-
},
|
|
1706
|
-
const d =
|
|
1707
|
-
return { width: i, height:
|
|
1726
|
+
}, pt = (t, e, n) => {
|
|
1727
|
+
const d = Oe(t, "horizontal"), r = Oe(t, "vertical"), c = t.getBoundingClientRect(), i = d.inner > 0 ? d.inner : e ?? c.width, p = r.inner > 0 ? r.inner : n ?? c.height;
|
|
1728
|
+
return { width: i, height: p };
|
|
1708
1729
|
}, fi = (t) => {
|
|
1709
|
-
const { id: e, className: n, style: d, children: r, direction:
|
|
1730
|
+
const { id: e, className: n, style: d, children: r, direction: c } = t, { groupRef: i, contextValue: p, groupStyle: u } = Ot(t), [z, s] = Me({ width: 0, height: 0 }), a = p.layoutConstraintViolation, o = !!a, h = ae(() => {
|
|
1710
1731
|
if (!a)
|
|
1711
1732
|
return null;
|
|
1712
|
-
const { summary:
|
|
1713
|
-
return /* @__PURE__ */
|
|
1733
|
+
const { summary: U, detail: V } = ri(a);
|
|
1734
|
+
return /* @__PURE__ */ fe(
|
|
1714
1735
|
"div",
|
|
1715
1736
|
{
|
|
1716
1737
|
className: "flex w-full flex-1 flex-col items-center justify-center gap-2 rounded-lg border border-slate-300 border-dashed bg-slate-100/70 px-6 py-8 text-center text-slate-600 text-sm dark:border-slate-600 dark:bg-slate-800/50 dark:text-slate-200",
|
|
1717
1738
|
"data-panel-group-placeholder": "constraint-violation",
|
|
1718
1739
|
children: [
|
|
1719
|
-
/* @__PURE__ */
|
|
1720
|
-
/* @__PURE__ */
|
|
1740
|
+
/* @__PURE__ */ I("span", { children: U }),
|
|
1741
|
+
/* @__PURE__ */ I("span", { className: "text-slate-500 text-xs dark:text-slate-400", children: V })
|
|
1721
1742
|
]
|
|
1722
1743
|
}
|
|
1723
1744
|
);
|
|
1724
|
-
}, [a]),
|
|
1725
|
-
if (!
|
|
1745
|
+
}, [a]), m = J(e ?? Zt()).current, v = e ?? m, x = p.showDebugInfo && p.panels.length > 0, C = x ? p.panels : [], S = x ? p.panelMeasurements : {}, D = ae(() => {
|
|
1746
|
+
if (!x)
|
|
1726
1747
|
return [];
|
|
1727
|
-
const
|
|
1728
|
-
return
|
|
1729
|
-
}, [
|
|
1730
|
-
|
|
1731
|
-
if (!
|
|
1748
|
+
const U = Object.values(p.handleMeasurements);
|
|
1749
|
+
return U.length <= 1 ? U : U.slice().sort((V, O) => V.id.localeCompare(O.id));
|
|
1750
|
+
}, [p.handleMeasurements, x]), X = p.containerSize, re = z.width > 0 ? z.width : X.width, de = z.height > 0 ? z.height : X.height, j = $t(), _ = x && j === m;
|
|
1751
|
+
Xe(() => {
|
|
1752
|
+
if (!x) {
|
|
1732
1753
|
s({ width: 0, height: 0 });
|
|
1733
1754
|
return;
|
|
1734
1755
|
}
|
|
1735
1756
|
if (typeof window > "u" || typeof ResizeObserver > "u")
|
|
1736
1757
|
return;
|
|
1737
|
-
const
|
|
1738
|
-
if (!
|
|
1758
|
+
const U = i.current;
|
|
1759
|
+
if (!U)
|
|
1739
1760
|
return;
|
|
1740
|
-
const
|
|
1741
|
-
s((
|
|
1742
|
-
},
|
|
1743
|
-
for (const
|
|
1744
|
-
if (
|
|
1761
|
+
const V = (Y) => {
|
|
1762
|
+
s((y) => y.width === Y.width && y.height === Y.height ? y : Y);
|
|
1763
|
+
}, O = new ResizeObserver((Y) => {
|
|
1764
|
+
for (const y of Y) {
|
|
1765
|
+
if (y.target !== U)
|
|
1745
1766
|
continue;
|
|
1746
|
-
const
|
|
1747
|
-
|
|
1767
|
+
const N = pt(U, y.contentRect.width, y.contentRect.height);
|
|
1768
|
+
V(N);
|
|
1748
1769
|
}
|
|
1749
1770
|
});
|
|
1750
|
-
return
|
|
1751
|
-
|
|
1771
|
+
return O.observe(U), V(pt(U)), () => {
|
|
1772
|
+
O.disconnect();
|
|
1752
1773
|
};
|
|
1753
|
-
}, [i,
|
|
1754
|
-
const
|
|
1755
|
-
|
|
1756
|
-
if (!
|
|
1757
|
-
|
|
1774
|
+
}, [i, x]);
|
|
1775
|
+
const E = ae(() => ni(C, S), [C, S]);
|
|
1776
|
+
se(() => {
|
|
1777
|
+
if (!x) {
|
|
1778
|
+
ct(m), dt(m);
|
|
1758
1779
|
return;
|
|
1759
1780
|
}
|
|
1760
|
-
return Vt(
|
|
1761
|
-
|
|
1781
|
+
return Vt(m), () => {
|
|
1782
|
+
ct(m), dt(m);
|
|
1762
1783
|
};
|
|
1763
|
-
}, [
|
|
1764
|
-
|
|
1784
|
+
}, [x, m]), se(() => {
|
|
1785
|
+
x && Yt(m, {
|
|
1765
1786
|
displayName: v,
|
|
1766
|
-
direction:
|
|
1787
|
+
direction: c,
|
|
1767
1788
|
containerSize: {
|
|
1768
|
-
width:
|
|
1769
|
-
height:
|
|
1789
|
+
width: re,
|
|
1790
|
+
height: de
|
|
1770
1791
|
},
|
|
1771
|
-
panels:
|
|
1792
|
+
panels: E,
|
|
1772
1793
|
handles: D
|
|
1773
1794
|
});
|
|
1774
|
-
}, [
|
|
1775
|
-
const
|
|
1776
|
-
const
|
|
1795
|
+
}, [x, m, v, c, re, de, E, D]);
|
|
1796
|
+
const oe = ae(() => {
|
|
1797
|
+
const U = {
|
|
1777
1798
|
...u,
|
|
1778
1799
|
...d
|
|
1779
1800
|
};
|
|
1780
|
-
return
|
|
1801
|
+
return U.position || (U.position = "relative"), U;
|
|
1781
1802
|
}, [u, d]);
|
|
1782
|
-
return /* @__PURE__ */
|
|
1783
|
-
/* @__PURE__ */
|
|
1803
|
+
return /* @__PURE__ */ fe(gt.Provider, { value: p, children: [
|
|
1804
|
+
/* @__PURE__ */ fe("div", { ref: i, className: $e("panel-group", c === "horizontal" ? "flex-row" : "flex-col", n), style: oe, "data-panel-group-id": e, "data-panel-group-direction": c, children: [
|
|
1784
1805
|
r,
|
|
1785
|
-
o &&
|
|
1806
|
+
o && h ? /* @__PURE__ */ I(
|
|
1786
1807
|
"div",
|
|
1787
1808
|
{
|
|
1788
1809
|
className: "pointer-events-auto",
|
|
@@ -1797,17 +1818,17 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
|
|
|
1797
1818
|
backgroundColor: "rgba(248, 250, 252, 0.82)",
|
|
1798
1819
|
backdropFilter: "blur(2px)"
|
|
1799
1820
|
},
|
|
1800
|
-
children:
|
|
1821
|
+
children: h
|
|
1801
1822
|
}
|
|
1802
1823
|
) : null
|
|
1803
1824
|
] }),
|
|
1804
|
-
|
|
1825
|
+
_ && /* @__PURE__ */ I(oi, {})
|
|
1805
1826
|
] });
|
|
1806
1827
|
}, oi = () => {
|
|
1807
|
-
const e = jt().groups, [n, d] =
|
|
1828
|
+
const e = jt().groups, [n, d] = Me(!0);
|
|
1808
1829
|
if (e.length === 0 || typeof document > "u")
|
|
1809
1830
|
return null;
|
|
1810
|
-
const r = e.reduce((u, z) => u + z.panels.length, 0),
|
|
1831
|
+
const r = e.reduce((u, z) => u + z.panels.length, 0), c = e.reduce((u, z) => u + (z.handles?.length ?? 0), 0), i = () => d((u) => !u), p = /* @__PURE__ */ fe(
|
|
1811
1832
|
"div",
|
|
1812
1833
|
{
|
|
1813
1834
|
style: {
|
|
@@ -1817,7 +1838,7 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
|
|
|
1817
1838
|
transition: "max-height 0.24s ease, padding 0.24s ease"
|
|
1818
1839
|
},
|
|
1819
1840
|
children: [
|
|
1820
|
-
/* @__PURE__ */
|
|
1841
|
+
/* @__PURE__ */ fe(
|
|
1821
1842
|
"div",
|
|
1822
1843
|
{
|
|
1823
1844
|
style: {
|
|
@@ -1825,8 +1846,8 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
|
|
|
1825
1846
|
marginBottom: n ? 0 : "12px"
|
|
1826
1847
|
},
|
|
1827
1848
|
children: [
|
|
1828
|
-
/* @__PURE__ */
|
|
1829
|
-
/* @__PURE__ */
|
|
1849
|
+
/* @__PURE__ */ fe("div", { style: Jt, children: [
|
|
1850
|
+
/* @__PURE__ */ I(
|
|
1830
1851
|
"span",
|
|
1831
1852
|
{
|
|
1832
1853
|
style: {
|
|
@@ -1837,16 +1858,16 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
|
|
|
1837
1858
|
children: "Panel Overview"
|
|
1838
1859
|
}
|
|
1839
1860
|
),
|
|
1840
|
-
/* @__PURE__ */
|
|
1861
|
+
/* @__PURE__ */ fe("span", { style: { color: "#cbd5f5" }, children: [
|
|
1841
1862
|
"groups: ",
|
|
1842
1863
|
e.length,
|
|
1843
1864
|
" / panels: ",
|
|
1844
1865
|
r,
|
|
1845
1866
|
" / resizers: ",
|
|
1846
|
-
|
|
1867
|
+
c
|
|
1847
1868
|
] })
|
|
1848
1869
|
] }),
|
|
1849
|
-
/* @__PURE__ */
|
|
1870
|
+
/* @__PURE__ */ I(
|
|
1850
1871
|
"button",
|
|
1851
1872
|
{
|
|
1852
1873
|
type: "button",
|
|
@@ -1862,7 +1883,7 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
|
|
|
1862
1883
|
]
|
|
1863
1884
|
}
|
|
1864
1885
|
),
|
|
1865
|
-
!n && /* @__PURE__ */
|
|
1886
|
+
!n && /* @__PURE__ */ I(
|
|
1866
1887
|
"div",
|
|
1867
1888
|
{
|
|
1868
1889
|
style: {
|
|
@@ -1875,18 +1896,18 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
|
|
|
1875
1896
|
},
|
|
1876
1897
|
children: e.map((u, z) => {
|
|
1877
1898
|
const s = u.direction === "horizontal" ? u.containerSize.width : u.containerSize.height;
|
|
1878
|
-
return /* @__PURE__ */
|
|
1879
|
-
/* @__PURE__ */
|
|
1899
|
+
return /* @__PURE__ */ fe("div", { style: Qt, children: [
|
|
1900
|
+
/* @__PURE__ */ fe(
|
|
1880
1901
|
"div",
|
|
1881
1902
|
{
|
|
1882
1903
|
style: {
|
|
1883
|
-
...
|
|
1904
|
+
...ft,
|
|
1884
1905
|
flexWrap: "wrap",
|
|
1885
1906
|
gap: "10px",
|
|
1886
1907
|
color: "#dbeafe"
|
|
1887
1908
|
},
|
|
1888
1909
|
children: [
|
|
1889
|
-
/* @__PURE__ */
|
|
1910
|
+
/* @__PURE__ */ fe(
|
|
1890
1911
|
"span",
|
|
1891
1912
|
{
|
|
1892
1913
|
style: {
|
|
@@ -1903,18 +1924,18 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
|
|
|
1903
1924
|
]
|
|
1904
1925
|
}
|
|
1905
1926
|
),
|
|
1906
|
-
/* @__PURE__ */
|
|
1927
|
+
/* @__PURE__ */ fe("span", { children: [
|
|
1907
1928
|
"direction: ",
|
|
1908
1929
|
u.direction,
|
|
1909
1930
|
" / container: ",
|
|
1910
|
-
|
|
1931
|
+
_e(u.containerSize.width, "px"),
|
|
1911
1932
|
" × ",
|
|
1912
|
-
|
|
1933
|
+
_e(u.containerSize.height, "px")
|
|
1913
1934
|
] })
|
|
1914
1935
|
]
|
|
1915
1936
|
}
|
|
1916
1937
|
),
|
|
1917
|
-
/* @__PURE__ */
|
|
1938
|
+
/* @__PURE__ */ I(
|
|
1918
1939
|
"div",
|
|
1919
1940
|
{
|
|
1920
1941
|
style: {
|
|
@@ -1923,43 +1944,43 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
|
|
|
1923
1944
|
gap: "10px"
|
|
1924
1945
|
},
|
|
1925
1946
|
children: u.panels.map((a, o) => {
|
|
1926
|
-
const
|
|
1927
|
-
return /* @__PURE__ */
|
|
1928
|
-
/* @__PURE__ */
|
|
1929
|
-
/* @__PURE__ */
|
|
1930
|
-
/* @__PURE__ */
|
|
1947
|
+
const h = a.measuredPixelSize ?? a.size, b = a.size, m = _e(b, "px"), v = a.percentageSize ?? (s > 0 ? a.size / s * 100 : void 0), x = a.measuredPercentageSize !== void 0 ? a.measuredPercentageSize : s > 0 ? h / s * 100 : void 0, C = a.collapsed || h <= St, S = a.collapsed ? "collapsed" : C ? "hidden" : "visible", D = _e(v, "%"), X = _e(x, "%"), re = _e(h, "px");
|
|
1948
|
+
return /* @__PURE__ */ fe("div", { style: ei, children: [
|
|
1949
|
+
/* @__PURE__ */ fe("div", { style: ft, children: [
|
|
1950
|
+
/* @__PURE__ */ I("span", { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis" }, children: a.id }),
|
|
1951
|
+
/* @__PURE__ */ I(
|
|
1931
1952
|
"span",
|
|
1932
1953
|
{
|
|
1933
1954
|
style: {
|
|
1934
1955
|
...ii,
|
|
1935
|
-
backgroundColor: a.collapsed ? "rgba(251, 113, 133, 0.25)" :
|
|
1936
|
-
color: a.collapsed ? "#fecdd3" :
|
|
1956
|
+
backgroundColor: a.collapsed ? "rgba(251, 113, 133, 0.25)" : C ? "rgba(250, 204, 21, 0.25)" : "rgba(74, 222, 128, 0.25)",
|
|
1957
|
+
color: a.collapsed ? "#fecdd3" : C ? "#fef08a" : "#bbf7d0"
|
|
1937
1958
|
},
|
|
1938
|
-
children:
|
|
1959
|
+
children: S
|
|
1939
1960
|
}
|
|
1940
1961
|
)
|
|
1941
1962
|
] }),
|
|
1942
|
-
/* @__PURE__ */
|
|
1943
|
-
/* @__PURE__ */
|
|
1944
|
-
/* @__PURE__ */
|
|
1945
|
-
/* @__PURE__ */
|
|
1946
|
-
/* @__PURE__ */
|
|
1947
|
-
/* @__PURE__ */
|
|
1948
|
-
/* @__PURE__ */
|
|
1949
|
-
/* @__PURE__ */
|
|
1950
|
-
/* @__PURE__ */
|
|
1951
|
-
/* @__PURE__ */
|
|
1952
|
-
/* @__PURE__ */
|
|
1953
|
-
/* @__PURE__ */
|
|
1954
|
-
/* @__PURE__ */
|
|
1955
|
-
/* @__PURE__ */
|
|
1956
|
-
/* @__PURE__ */
|
|
1957
|
-
/* @__PURE__ */
|
|
1958
|
-
/* @__PURE__ */
|
|
1959
|
-
/* @__PURE__ */
|
|
1960
|
-
/* @__PURE__ */
|
|
1961
|
-
/* @__PURE__ */
|
|
1962
|
-
/* @__PURE__ */
|
|
1963
|
+
/* @__PURE__ */ fe("div", { style: ti, children: [
|
|
1964
|
+
/* @__PURE__ */ I("span", { children: "size (state):" }),
|
|
1965
|
+
/* @__PURE__ */ I("span", { children: m }),
|
|
1966
|
+
/* @__PURE__ */ I("span", { children: "size (measured):" }),
|
|
1967
|
+
/* @__PURE__ */ I("span", { children: re }),
|
|
1968
|
+
/* @__PURE__ */ I("span", { children: "percentage (state):" }),
|
|
1969
|
+
/* @__PURE__ */ I("span", { children: D }),
|
|
1970
|
+
/* @__PURE__ */ I("span", { children: "percentage (measured):" }),
|
|
1971
|
+
/* @__PURE__ */ I("span", { children: X }),
|
|
1972
|
+
/* @__PURE__ */ I("span", { children: "unit:" }),
|
|
1973
|
+
/* @__PURE__ */ I("span", { children: a.sizeUnit }),
|
|
1974
|
+
/* @__PURE__ */ I("span", { children: "min:" }),
|
|
1975
|
+
/* @__PURE__ */ I("span", { children: a.minSize !== void 0 ? JSON.stringify(a.minSize) : "—" }),
|
|
1976
|
+
/* @__PURE__ */ I("span", { children: "auto min:" }),
|
|
1977
|
+
/* @__PURE__ */ I("span", { children: a.autoMinSize !== void 0 ? JSON.stringify(a.autoMinSize) : "—" }),
|
|
1978
|
+
/* @__PURE__ */ I("span", { children: "max:" }),
|
|
1979
|
+
/* @__PURE__ */ I("span", { children: a.maxSize !== void 0 ? JSON.stringify(a.maxSize) : "—" }),
|
|
1980
|
+
/* @__PURE__ */ I("span", { children: "priority:" }),
|
|
1981
|
+
/* @__PURE__ */ I("span", { children: a.pixelAdjustPriority ?? "—" }),
|
|
1982
|
+
/* @__PURE__ */ I("span", { children: "flex priority:" }),
|
|
1983
|
+
/* @__PURE__ */ I("span", { children: a.flexAdjustPriority ?? "—" })
|
|
1963
1984
|
] })
|
|
1964
1985
|
] }, a.id || o);
|
|
1965
1986
|
})
|
|
@@ -1972,287 +1993,287 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
|
|
|
1972
1993
|
]
|
|
1973
1994
|
}
|
|
1974
1995
|
);
|
|
1975
|
-
return Et(
|
|
1976
|
-
}, pi =
|
|
1977
|
-
const { direction: i, resizePanels:
|
|
1978
|
-
|
|
1979
|
-
if (
|
|
1980
|
-
const
|
|
1981
|
-
if (
|
|
1982
|
-
|
|
1983
|
-
const
|
|
1984
|
-
if (
|
|
1985
|
-
let
|
|
1986
|
-
for (let
|
|
1987
|
-
const
|
|
1988
|
-
if (
|
|
1989
|
-
|
|
1996
|
+
return Et(p, document.body);
|
|
1997
|
+
}, pi = it(({ id: t, disabled: e = !1, className: n, style: d, children: r, onDragging: c }) => {
|
|
1998
|
+
const { direction: i, resizePanels: p, getPanel: u, collapsePanel: z, expandPanel: s, panels: a, reportHandleMeasurement: o, containerSize: h, layoutConstraintViolation: b } = rt(), [m, v] = Me(!1), x = J(null), C = J(null), S = J(""), D = J(""), [X, re] = Me({ left: null, right: null }), de = zt(), j = J(t ?? `resize-handle-${de}`), _ = J(null), E = t ?? j.current, oe = !!b, U = e || oe;
|
|
1999
|
+
se(() => {
|
|
2000
|
+
if (x.current) {
|
|
2001
|
+
const P = x.current.parentElement;
|
|
2002
|
+
if (P) {
|
|
2003
|
+
C.current = P;
|
|
2004
|
+
const $ = Array.from(P.children), l = x.current, g = $.indexOf(l);
|
|
2005
|
+
if (g > 0 && g < $.length - 1) {
|
|
2006
|
+
let w = null, M = null;
|
|
2007
|
+
for (let A = g - 1; A >= 0; A -= 1) {
|
|
2008
|
+
const B = $[A];
|
|
2009
|
+
if (B.dataset.panelId) {
|
|
2010
|
+
w = B;
|
|
1990
2011
|
break;
|
|
1991
2012
|
}
|
|
1992
2013
|
}
|
|
1993
|
-
for (let
|
|
1994
|
-
const
|
|
1995
|
-
if (
|
|
1996
|
-
|
|
2014
|
+
for (let A = g + 1; A < $.length; A += 1) {
|
|
2015
|
+
const B = $[A];
|
|
2016
|
+
if (B.dataset.panelId) {
|
|
2017
|
+
M = B;
|
|
1997
2018
|
break;
|
|
1998
2019
|
}
|
|
1999
2020
|
}
|
|
2000
|
-
|
|
2001
|
-
left:
|
|
2021
|
+
S.current = w?.dataset.panelId || "", D.current = M?.dataset.panelId || "", re({
|
|
2022
|
+
left: S.current || null,
|
|
2002
2023
|
right: D.current || null
|
|
2003
2024
|
});
|
|
2004
2025
|
}
|
|
2005
2026
|
}
|
|
2006
2027
|
}
|
|
2007
|
-
}, []),
|
|
2008
|
-
if (
|
|
2028
|
+
}, []), se(() => {
|
|
2029
|
+
if (E === j.current)
|
|
2009
2030
|
return;
|
|
2010
|
-
const
|
|
2011
|
-
|
|
2012
|
-
}, [o,
|
|
2013
|
-
const
|
|
2031
|
+
const P = j.current;
|
|
2032
|
+
j.current = E, _.current = null, P !== E && o(P, null);
|
|
2033
|
+
}, [o, E]), se(() => {
|
|
2034
|
+
const P = j.current;
|
|
2014
2035
|
return () => {
|
|
2015
|
-
o(
|
|
2036
|
+
o(P, null);
|
|
2016
2037
|
};
|
|
2017
2038
|
}, [o]);
|
|
2018
|
-
const
|
|
2019
|
-
(
|
|
2020
|
-
if (
|
|
2021
|
-
|
|
2022
|
-
const
|
|
2023
|
-
if (!(
|
|
2024
|
-
const
|
|
2025
|
-
let
|
|
2026
|
-
const
|
|
2027
|
-
v(!0),
|
|
2028
|
-
const
|
|
2029
|
-
if (!
|
|
2030
|
-
|
|
2031
|
-
const
|
|
2032
|
-
if (
|
|
2033
|
-
|
|
2034
|
-
const
|
|
2035
|
-
if (
|
|
2039
|
+
const V = Se(
|
|
2040
|
+
(P) => {
|
|
2041
|
+
if (U || !C.current) return;
|
|
2042
|
+
P.preventDefault(), P.stopPropagation();
|
|
2043
|
+
const $ = C.current, { inner: l } = Oe($, i), g = { x: P.clientX, y: P.clientY }, w = u(S.current), M = u(D.current);
|
|
2044
|
+
if (!(w && M)) return;
|
|
2045
|
+
const A = w.size, B = M.size;
|
|
2046
|
+
let H = 0;
|
|
2047
|
+
const Z = Rt;
|
|
2048
|
+
v(!0), c?.(!0), P.currentTarget.setPointerCapture(P.pointerId);
|
|
2049
|
+
const T = (F) => {
|
|
2050
|
+
if (!x.current) return;
|
|
2051
|
+
F.preventDefault(), F.stopPropagation();
|
|
2052
|
+
const k = performance.now();
|
|
2053
|
+
if (k - H < Z) return;
|
|
2054
|
+
H = k;
|
|
2055
|
+
const Q = i === "horizontal" ? F.clientX - g.x : F.clientY - g.y;
|
|
2056
|
+
if (Q === 0)
|
|
2036
2057
|
return;
|
|
2037
|
-
const
|
|
2038
|
-
if (
|
|
2039
|
-
const
|
|
2040
|
-
if (
|
|
2058
|
+
const ne = A + Q, K = B - Q, W = u(S.current), q = u(D.current);
|
|
2059
|
+
if (W && q && S.current && D.current) {
|
|
2060
|
+
const f = te(W.minSize, 0, l), L = te(q.minSize, 0, l), ee = f, ie = L, xe = Math.min(l * mt, Pt), Ne = Math.min(l * It, Ft), ke = q.collapseFromStart, Ae = q.collapsedByDirection ?? "start";
|
|
2061
|
+
if (ke && !q.collapsed && K <= Math.max(L * 0.3, xe)) {
|
|
2041
2062
|
z(D.current, "start");
|
|
2042
2063
|
return;
|
|
2043
2064
|
}
|
|
2044
|
-
const
|
|
2045
|
-
if (
|
|
2046
|
-
z(
|
|
2065
|
+
const Ge = W.collapseFromEnd, Te = W.collapsedByDirection ?? "end";
|
|
2066
|
+
if (Ge && !W.collapsed && ne <= Math.max(f * 0.3, xe)) {
|
|
2067
|
+
z(S.current, "end");
|
|
2047
2068
|
return;
|
|
2048
2069
|
}
|
|
2049
|
-
if (
|
|
2050
|
-
s(D.current,
|
|
2070
|
+
if (q.collapsed && K > Math.max(L * 0.3, Ne)) {
|
|
2071
|
+
s(D.current, Ae, K);
|
|
2051
2072
|
return;
|
|
2052
2073
|
}
|
|
2053
|
-
if (
|
|
2054
|
-
s(
|
|
2074
|
+
if (W.collapsed && ne > Math.max(f * 0.3, Ne)) {
|
|
2075
|
+
s(S.current, Te, ne);
|
|
2055
2076
|
return;
|
|
2056
2077
|
}
|
|
2057
|
-
if (
|
|
2058
|
-
const
|
|
2059
|
-
let
|
|
2060
|
-
if (
|
|
2061
|
-
const
|
|
2062
|
-
|
|
2063
|
-
} else if (
|
|
2064
|
-
const
|
|
2065
|
-
|
|
2078
|
+
if (l > 0) {
|
|
2079
|
+
const we = W.size + q.size, Ie = et(l);
|
|
2080
|
+
let Je = !1;
|
|
2081
|
+
if (ee <= Ie && ne <= Ie && A !== 0) {
|
|
2082
|
+
const He = Math.max(0, we - 0);
|
|
2083
|
+
He >= ie && (p(S.current, D.current, 0, He), Je = !0);
|
|
2084
|
+
} else if (ie <= Ie && K <= Ie && B !== 0) {
|
|
2085
|
+
const He = Math.max(0, we - 0);
|
|
2086
|
+
He >= ee && (p(S.current, D.current, He, 0), Je = !0);
|
|
2066
2087
|
}
|
|
2067
|
-
if (
|
|
2088
|
+
if (Je)
|
|
2068
2089
|
return;
|
|
2069
2090
|
}
|
|
2070
|
-
if (
|
|
2091
|
+
if (W.collapsed || q.collapsed)
|
|
2071
2092
|
return;
|
|
2072
|
-
|
|
2093
|
+
p(S.current, D.current, ne, K);
|
|
2073
2094
|
}
|
|
2074
|
-
},
|
|
2075
|
-
v(!1),
|
|
2095
|
+
}, R = () => {
|
|
2096
|
+
v(!1), c?.(!1), document.removeEventListener("pointermove", T), document.removeEventListener("pointerup", R);
|
|
2076
2097
|
};
|
|
2077
|
-
document.addEventListener("pointermove",
|
|
2098
|
+
document.addEventListener("pointermove", T), document.addEventListener("pointerup", R);
|
|
2078
2099
|
},
|
|
2079
|
-
[
|
|
2080
|
-
),
|
|
2100
|
+
[U, i, p, u, z, s, c]
|
|
2101
|
+
), O = i === "horizontal", y = $e(
|
|
2081
2102
|
"group absolute z-20 flex select-none items-center justify-center border-none bg-transparent transition-colors duration-150 overflow-visible",
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
!
|
|
2085
|
-
!
|
|
2086
|
-
|
|
2087
|
-
|
|
2103
|
+
O ? "cursor-col-resize" : "cursor-row-resize",
|
|
2104
|
+
O ? "h-full" : "w-full",
|
|
2105
|
+
!U && "hover:bg-gray-200/70 dark:hover:bg-gray-700/70",
|
|
2106
|
+
!U && "active:bg-blue-300/60 dark:active:bg-blue-700/60",
|
|
2107
|
+
m && "bg-blue-200/80 dark:bg-blue-800/60",
|
|
2108
|
+
U && "cursor-not-allowed opacity-50",
|
|
2088
2109
|
"focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50",
|
|
2089
2110
|
n
|
|
2090
|
-
),
|
|
2091
|
-
const
|
|
2092
|
-
if (
|
|
2111
|
+
), N = ae(() => {
|
|
2112
|
+
const P = ($) => {
|
|
2113
|
+
if (!$)
|
|
2093
2114
|
return -1;
|
|
2094
|
-
for (let
|
|
2095
|
-
if (a[
|
|
2096
|
-
return
|
|
2115
|
+
for (let l = 0; l < a.length; l += 1)
|
|
2116
|
+
if (a[l].id === $)
|
|
2117
|
+
return l;
|
|
2097
2118
|
return -1;
|
|
2098
2119
|
};
|
|
2099
2120
|
return {
|
|
2100
|
-
left:
|
|
2101
|
-
right:
|
|
2121
|
+
left: P(X.left),
|
|
2122
|
+
right: P(X.right)
|
|
2102
2123
|
};
|
|
2103
|
-
}, [X.left, X.right, a]),
|
|
2104
|
-
const
|
|
2105
|
-
if (
|
|
2124
|
+
}, [X.left, X.right, a]), be = O ? h.width : h.height, ce = ae(() => {
|
|
2125
|
+
const P = ($, l) => {
|
|
2126
|
+
if ($ > l)
|
|
2106
2127
|
return 0;
|
|
2107
|
-
let
|
|
2108
|
-
for (let
|
|
2109
|
-
const
|
|
2110
|
-
if (!
|
|
2128
|
+
let g = 0;
|
|
2129
|
+
for (let w = $; w <= l; w += 1) {
|
|
2130
|
+
const M = a[w];
|
|
2131
|
+
if (!M)
|
|
2111
2132
|
continue;
|
|
2112
|
-
const
|
|
2113
|
-
|
|
2133
|
+
const A = M.size ?? 0, B = Math.max(0, A);
|
|
2134
|
+
g += M.collapsed ? 0 : B;
|
|
2114
2135
|
}
|
|
2115
|
-
return
|
|
2136
|
+
return g;
|
|
2116
2137
|
};
|
|
2117
|
-
return
|
|
2118
|
-
}, [
|
|
2119
|
-
const
|
|
2138
|
+
return N.left >= 0 ? P(0, N.left) : N.right > 0 ? P(0, N.right - 1) : 0;
|
|
2139
|
+
}, [N.left, N.right, a]), Pe = ae(() => !Number.isFinite(ce) || ce < 0 ? 0 : be > 0 && ce > be ? be : ce, [ce, be]), he = ae(() => {
|
|
2140
|
+
const P = {
|
|
2120
2141
|
position: "absolute",
|
|
2121
2142
|
zIndex: 20,
|
|
2122
2143
|
touchAction: "none"
|
|
2123
2144
|
};
|
|
2124
|
-
return
|
|
2125
|
-
}, [
|
|
2126
|
-
const
|
|
2127
|
-
if (
|
|
2145
|
+
return O ? (P.top = 0, P.left = `${Pe}px`, P.transform = "translateX(-50%)", P.width = `${nt}px`, P.height = "100%") : (P.left = 0, P.top = `${Pe}px`, P.transform = "translateY(-50%)", P.height = `${nt}px`, P.width = "100%"), P;
|
|
2146
|
+
}, [Pe, O]), ue = ae(() => {
|
|
2147
|
+
const P = et(be), $ = (Z) => {
|
|
2148
|
+
if (Z < 0 || Z >= a.length)
|
|
2128
2149
|
return !1;
|
|
2129
|
-
const
|
|
2130
|
-
return
|
|
2131
|
-
},
|
|
2132
|
-
if (
|
|
2150
|
+
const T = a[Z];
|
|
2151
|
+
return T ? T.collapsed ? !0 : T.size <= P : !1;
|
|
2152
|
+
}, l = (Z, T) => {
|
|
2153
|
+
if (!$(Z))
|
|
2133
2154
|
return 0;
|
|
2134
|
-
let
|
|
2135
|
-
for (let
|
|
2136
|
-
|
|
2137
|
-
return
|
|
2138
|
-
},
|
|
2155
|
+
let R = 0;
|
|
2156
|
+
for (let F = Z; F >= 0 && F < a.length && $(F); F += T)
|
|
2157
|
+
R += 1;
|
|
2158
|
+
return R;
|
|
2159
|
+
}, g = N.left, w = N.right, M = g >= 0 ? l(g, -1) : 0, A = w >= 0 ? l(w, 1) : 0;
|
|
2139
2160
|
return {
|
|
2140
|
-
groupSize:
|
|
2141
|
-
overlapIndex:
|
|
2161
|
+
groupSize: M + A + 1,
|
|
2162
|
+
overlapIndex: M
|
|
2142
2163
|
};
|
|
2143
|
-
}, [
|
|
2144
|
-
if (
|
|
2164
|
+
}, [N.left, N.right, a, be]), pe = ae(() => {
|
|
2165
|
+
if (oe)
|
|
2145
2166
|
return !0;
|
|
2146
|
-
if (
|
|
2167
|
+
if (ue.groupSize <= 1)
|
|
2147
2168
|
return !1;
|
|
2148
|
-
const
|
|
2149
|
-
return
|
|
2150
|
-
}, [
|
|
2151
|
-
if (
|
|
2169
|
+
const P = ue.groupSize - 1;
|
|
2170
|
+
return ue.overlapIndex > 0 && ue.overlapIndex < P;
|
|
2171
|
+
}, [ue, oe]), ge = ae(() => {
|
|
2172
|
+
if (ue.groupSize <= 1 || pe)
|
|
2152
2173
|
return 0;
|
|
2153
|
-
const
|
|
2154
|
-
if (
|
|
2174
|
+
const P = ue.groupSize > 1 ? 2 : 1;
|
|
2175
|
+
if (P === 1)
|
|
2155
2176
|
return 0;
|
|
2156
|
-
const
|
|
2157
|
-
return (
|
|
2158
|
-
}, [
|
|
2159
|
-
if (
|
|
2177
|
+
const $ = ue.overlapIndex === 0 ? 0 : P - 1, l = (P - 1) / 2;
|
|
2178
|
+
return ($ - l) * Bt;
|
|
2179
|
+
}, [ue, pe]), ye = ae(() => {
|
|
2180
|
+
if (pe)
|
|
2160
2181
|
return { display: "none" };
|
|
2161
|
-
if (
|
|
2162
|
-
return
|
|
2163
|
-
}, [
|
|
2182
|
+
if (ge !== 0)
|
|
2183
|
+
return O ? { transform: `translateX(${ge}px)` } : { transform: `translateY(${ge}px)` };
|
|
2184
|
+
}, [ge, O, pe]), Be = $e(
|
|
2164
2185
|
"flex items-center justify-center rounded-full bg-white text-slate-700 ring-1 ring-inset ring-white/80 backdrop-blur-sm transition-colors duration-150 shadow-[0_0_0_1px_rgba(255,255,255,0.85),0_1px_3px_rgba(15,23,42,0.18)]",
|
|
2165
2186
|
"dark:bg-slate-800/95 dark:text-slate-200 dark:ring-slate-500/60 dark:shadow-[0_0_0_1px_rgba(148,163,184,0.45),0_1px_3px_rgba(2,6,23,0.55)]",
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
),
|
|
2187
|
+
O ? "h-12 w-[6px] px-[2px]" : "h-[6px] w-20 py-[2px]",
|
|
2188
|
+
m && "bg-blue-200/80 ring-blue-300 shadow-[0_0_0_1px_rgba(191,219,254,0.65),0_1px_4px_rgba(59,130,246,0.45)] dark:bg-blue-900/70 dark:ring-blue-400 dark:shadow-[0_0_0_1px_rgba(147,197,253,0.5),0_1px_4px_rgba(59,130,246,0.55)]"
|
|
2189
|
+
), Re = $e(
|
|
2169
2190
|
"rounded-full bg-slate-600 transition-colors duration-150 shadow-[0_0_0_1px_rgba(255,255,255,0.9)] dark:bg-slate-200 dark:shadow-[0_0_0_1px_rgba(15,23,42,0.55)]",
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
!
|
|
2173
|
-
),
|
|
2174
|
-
const
|
|
2175
|
-
if (!
|
|
2191
|
+
O ? "h-8 w-[2px]" : "h-[2px] w-16",
|
|
2192
|
+
m && "bg-blue-500 dark:bg-blue-300",
|
|
2193
|
+
!U && "group-hover:bg-slate-700 dark:group-hover:bg-slate-100"
|
|
2194
|
+
), G = Se(() => {
|
|
2195
|
+
const P = x.current;
|
|
2196
|
+
if (!P)
|
|
2176
2197
|
return;
|
|
2177
|
-
let
|
|
2178
|
-
if (!
|
|
2179
|
-
const
|
|
2180
|
-
let
|
|
2198
|
+
let $ = 0;
|
|
2199
|
+
if (!pe) {
|
|
2200
|
+
const w = i === "horizontal" ? P.offsetWidth : P.offsetHeight;
|
|
2201
|
+
let M = 0, A = 0;
|
|
2181
2202
|
if (typeof window < "u") {
|
|
2182
|
-
const
|
|
2183
|
-
i === "horizontal" ? (
|
|
2203
|
+
const H = window.getComputedStyle(P);
|
|
2204
|
+
i === "horizontal" ? (M = Number.parseFloat(H.marginLeft || "0"), A = Number.parseFloat(H.marginRight || "0")) : (M = Number.parseFloat(H.marginTop || "0"), A = Number.parseFloat(H.marginBottom || "0"));
|
|
2184
2205
|
}
|
|
2185
|
-
|
|
2206
|
+
$ = [w, M, A].reduce((H, Z) => Number.isFinite(Z) ? H + Z : H, 0);
|
|
2186
2207
|
}
|
|
2187
|
-
(!Number.isFinite(
|
|
2188
|
-
const
|
|
2189
|
-
id:
|
|
2190
|
-
thickness:
|
|
2208
|
+
(!Number.isFinite($) || $ < 0) && ($ = 0);
|
|
2209
|
+
const l = {
|
|
2210
|
+
id: E,
|
|
2211
|
+
thickness: $,
|
|
2191
2212
|
direction: i,
|
|
2192
|
-
visible: !
|
|
2213
|
+
visible: !pe && $ > Nt,
|
|
2193
2214
|
startPanelId: X.left,
|
|
2194
2215
|
endPanelId: X.right
|
|
2195
|
-
},
|
|
2196
|
-
|
|
2197
|
-
}, [i, X.left, X.right, o,
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
}, [
|
|
2201
|
-
const
|
|
2202
|
-
if (!
|
|
2216
|
+
}, g = _.current;
|
|
2217
|
+
g && Math.abs(g.thickness - l.thickness) <= 0.25 && g.visible === l.visible && g.direction === l.direction && g.startPanelId === l.startPanelId && g.endPanelId === l.endPanelId || (_.current = l, o(E, l));
|
|
2218
|
+
}, [i, X.left, X.right, o, E, pe]);
|
|
2219
|
+
se(() => {
|
|
2220
|
+
G();
|
|
2221
|
+
}, [G]), se(() => {
|
|
2222
|
+
const P = x.current;
|
|
2223
|
+
if (!P)
|
|
2203
2224
|
return;
|
|
2204
2225
|
if (typeof ResizeObserver > "u") {
|
|
2205
|
-
|
|
2226
|
+
G();
|
|
2206
2227
|
return;
|
|
2207
2228
|
}
|
|
2208
|
-
const
|
|
2209
|
-
|
|
2229
|
+
const $ = new ResizeObserver(() => {
|
|
2230
|
+
G();
|
|
2210
2231
|
});
|
|
2211
|
-
return
|
|
2212
|
-
|
|
2232
|
+
return $.observe(P), () => {
|
|
2233
|
+
$.disconnect();
|
|
2213
2234
|
};
|
|
2214
|
-
}, [
|
|
2215
|
-
const
|
|
2216
|
-
const
|
|
2217
|
-
return
|
|
2218
|
-
...
|
|
2235
|
+
}, [G]);
|
|
2236
|
+
const le = ae(() => {
|
|
2237
|
+
const P = d ? { ...he, ...d } : he;
|
|
2238
|
+
return pe ? {
|
|
2239
|
+
...P,
|
|
2219
2240
|
display: "none",
|
|
2220
2241
|
pointerEvents: "none",
|
|
2221
2242
|
visibility: "hidden"
|
|
2222
|
-
} :
|
|
2223
|
-
}, [
|
|
2224
|
-
return /* @__PURE__ */
|
|
2243
|
+
} : P;
|
|
2244
|
+
}, [he, pe, d]);
|
|
2245
|
+
return /* @__PURE__ */ I(
|
|
2225
2246
|
"button",
|
|
2226
2247
|
{
|
|
2227
2248
|
type: "button",
|
|
2228
|
-
ref:
|
|
2229
|
-
className:
|
|
2230
|
-
style:
|
|
2231
|
-
onPointerDown:
|
|
2232
|
-
disabled:
|
|
2233
|
-
"aria-hidden":
|
|
2234
|
-
"aria-label": `Resize ${
|
|
2235
|
-
"data-resize-handle-id":
|
|
2236
|
-
title: `ドラッグして${
|
|
2237
|
-
children: r || /* @__PURE__ */
|
|
2249
|
+
ref: x,
|
|
2250
|
+
className: y,
|
|
2251
|
+
style: le,
|
|
2252
|
+
onPointerDown: V,
|
|
2253
|
+
disabled: U,
|
|
2254
|
+
"aria-hidden": pe || void 0,
|
|
2255
|
+
"aria-label": `Resize ${O ? "columns" : "rows"} - Drag to collapse/expand panels`,
|
|
2256
|
+
"data-resize-handle-id": E,
|
|
2257
|
+
title: `ドラッグして${O ? "列" : "行"}をリサイズ、端まで移動して折りたたみ/展開`,
|
|
2258
|
+
children: r || /* @__PURE__ */ I("div", { className: Be, style: ye, children: /* @__PURE__ */ I("span", { className: Re }) })
|
|
2238
2259
|
}
|
|
2239
2260
|
);
|
|
2240
|
-
}), zi = (t) => document.querySelector(`[data-panel-id="${t}"]`),
|
|
2261
|
+
}), zi = (t) => document.querySelector(`[data-panel-id="${t}"]`), hi = (t) => document.querySelector(`[data-panel-group-id="${t}"]`), gi = (t) => document.querySelector(`[data-resize-handle-id="${t}"]`);
|
|
2241
2262
|
export {
|
|
2242
2263
|
ui as Panel,
|
|
2243
2264
|
fi as PanelGroup,
|
|
2244
|
-
|
|
2265
|
+
gt as PanelGroupContext,
|
|
2245
2266
|
pi as PanelResizeHandle,
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2267
|
+
me as clamp,
|
|
2268
|
+
te as getConstraintInPixels,
|
|
2269
|
+
Oe as getContainerSize,
|
|
2249
2270
|
zi as getPanelElement,
|
|
2250
|
-
|
|
2251
|
-
|
|
2271
|
+
hi as getPanelGroupElement,
|
|
2272
|
+
gi as getResizeHandleElement,
|
|
2252
2273
|
Lt as loadLayout,
|
|
2253
|
-
|
|
2274
|
+
Qe as normalizeSizeConfig,
|
|
2254
2275
|
At as saveLayout,
|
|
2255
2276
|
di as usePanelControls,
|
|
2256
|
-
|
|
2277
|
+
rt as usePanelGroup,
|
|
2257
2278
|
Ot as useResizablePanels
|
|
2258
2279
|
};
|