@aiquants/resize-panels 1.7.0 → 1.7.3
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 +13 -7
- package/dist/GlobalDebugOverlay-DYCR0FIu.js +252 -0
- package/dist/GlobalDebugOverlay-afs0vF-Q.cjs +1 -0
- package/dist/GlobalDebugOverlay.d.ts +21 -0
- package/dist/GlobalDebugOverlay.d.ts.map +1 -0
- package/dist/Panel.d.ts.map +1 -1
- package/dist/PanelGroup.d.ts.map +1 -1
- package/dist/PanelResizeHandle.d.ts.map +1 -1
- package/dist/debugOverlayStore-Cntyxboe.js +141 -0
- package/dist/debugOverlayStore-Dkl-fHoa.cjs +1 -0
- package/dist/hooks.d.ts.map +1 -1
- package/dist/index-BzgId8aQ.js +1972 -0
- package/dist/index-xTV-c0PN.cjs +2 -0
- package/dist/index.cjs +1 -2
- package/dist/index.js +17 -2277
- package/dist/reducer.d.ts.map +1 -1
- package/dist/resize-panels.css +1 -1
- package/dist/styles/resize-panels.css +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/simple-logger.d.ts +19 -6
- package/dist/utils/simple-logger.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,2279 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { jsx as I, jsxs as fe } from "react/jsx-runtime";
|
|
3
|
-
import { twMerge as $e } from "tailwind-merge";
|
|
4
|
-
import { createPortal as Et } from "react-dom";
|
|
5
|
-
const gt = vt(null), rt = () => {
|
|
6
|
-
const t = Mt(gt);
|
|
7
|
-
if (!t)
|
|
8
|
-
throw new Error("usePanelGroup must be used within a PanelGroup");
|
|
9
|
-
return t;
|
|
10
|
-
}, xt = (t, e = 0) => {
|
|
11
|
-
if (!Number.isFinite(t))
|
|
12
|
-
return t;
|
|
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
|
-
if (t !== void 0)
|
|
17
|
-
return typeof t == "number" ? { value: t, unit: e } : t;
|
|
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
|
-
if (!Number.isFinite(t) || t <= 0)
|
|
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
|
-
if (Math.abs(e) <= 0)
|
|
25
|
-
return e;
|
|
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
|
-
return e;
|
|
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
|
-
});
|
|
33
|
-
let u = e;
|
|
34
|
-
const z = (s) => {
|
|
35
|
-
for (const { index: a } of p) {
|
|
36
|
-
if (Math.abs(u) <= 0)
|
|
37
|
-
break;
|
|
38
|
-
const o = t[a];
|
|
39
|
-
if (!o || o.collapsed)
|
|
40
|
-
continue;
|
|
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
|
-
if (u > 0) {
|
|
43
|
-
if (Math.abs(o.size) <= 0 && (o.percentageSize ?? 0) <= 0)
|
|
44
|
-
continue;
|
|
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
|
-
continue;
|
|
48
|
-
const _ = Math.min(j, u);
|
|
49
|
-
if (_ <= 0)
|
|
50
|
-
continue;
|
|
51
|
-
const E = o.size + _, oe = Ce(E, n), U = D ? E : o.sizeBeforeCollapse, V = D ? o.measuredPixelSizeBeforeCollapse ?? o.measuredPixelSize ?? E : o.measuredPixelSizeBeforeCollapse;
|
|
52
|
-
t[a] = {
|
|
53
|
-
...o,
|
|
54
|
-
size: E,
|
|
55
|
-
percentageSize: oe,
|
|
56
|
-
sizeBeforeCollapse: U,
|
|
57
|
-
measuredPixelSizeBeforeCollapse: V,
|
|
58
|
-
measuredPixelSize: void 0,
|
|
59
|
-
measuredPercentageSize: void 0
|
|
60
|
-
}, u -= _;
|
|
61
|
-
} else {
|
|
62
|
-
const X = s ? S : C, re = Math.max(0, o.size - X);
|
|
63
|
-
if (re <= 0)
|
|
64
|
-
continue;
|
|
65
|
-
const de = Math.min(re, Math.abs(u));
|
|
66
|
-
if (de <= 0)
|
|
67
|
-
continue;
|
|
68
|
-
const j = o.size - de, _ = Ce(j, n), E = D ? j : o.sizeBeforeCollapse, oe = D ? o.measuredPixelSizeBeforeCollapse ?? o.measuredPixelSize ?? j : o.measuredPixelSizeBeforeCollapse;
|
|
69
|
-
t[a] = {
|
|
70
|
-
...o,
|
|
71
|
-
size: j,
|
|
72
|
-
percentageSize: _,
|
|
73
|
-
sizeBeforeCollapse: E,
|
|
74
|
-
measuredPixelSizeBeforeCollapse: oe,
|
|
75
|
-
measuredPixelSize: void 0,
|
|
76
|
-
measuredPercentageSize: void 0
|
|
77
|
-
}, u += de;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
return z(!0), (i && u > 0 || !i && u < 0) && z(!1), u;
|
|
82
|
-
}, Ve = (t) => {
|
|
83
|
-
if (!t)
|
|
84
|
-
return 0;
|
|
85
|
-
const e = parseFloat(t);
|
|
86
|
-
return Number.isFinite(e) ? e : 0;
|
|
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
|
-
if (e === "horizontal") {
|
|
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
|
-
return {
|
|
92
|
-
inner: s > 0 ? s : Math.max(0, t.clientWidth),
|
|
93
|
-
outer: z > 0 ? z : Math.max(0, a)
|
|
94
|
-
};
|
|
95
|
-
}
|
|
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
|
-
return {
|
|
98
|
-
inner: p > 0 ? p : Math.max(0, t.clientHeight),
|
|
99
|
-
outer: i > 0 ? i : Math.max(0, u)
|
|
100
|
-
};
|
|
101
|
-
}, At = (t, e) => {
|
|
102
|
-
try {
|
|
103
|
-
localStorage.setItem(`panel-layout-${t}`, JSON.stringify(e));
|
|
104
|
-
} catch (n) {
|
|
105
|
-
console.warn("Failed to save panel layout:", n);
|
|
106
|
-
}
|
|
107
|
-
}, Lt = (t) => {
|
|
108
|
-
try {
|
|
109
|
-
const e = localStorage.getItem(`panel-layout-${t}`);
|
|
110
|
-
return e ? JSON.parse(e) : null;
|
|
111
|
-
} catch (e) {
|
|
112
|
-
return console.warn("Failed to load panel layout:", e), null;
|
|
113
|
-
}
|
|
114
|
-
};
|
|
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
|
-
/**
|
|
118
|
-
* @constructor
|
|
119
|
-
* @param {LogLevel} [level=LogLevel.WARN] - The minimum log level to output.
|
|
120
|
-
* @param {string} [prefix="[resize-panels]"] - The prefix to add to all log messages.
|
|
121
|
-
* @param {ILogger} [impl=console] - The implementation to use for logging.
|
|
122
|
-
*/
|
|
123
|
-
constructor(e = 2, n = "[resize-panels]", d = console) {
|
|
124
|
-
this.level = e, this.prefix = n, this.impl = d;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* @method setLevel
|
|
128
|
-
* @description Updates the current log level for the static instance.
|
|
129
|
-
* @description 静的インスタンスの現在のログレベルを更新します。
|
|
130
|
-
* @param {LogLevel} level - The new log level.
|
|
131
|
-
*/
|
|
132
|
-
static setLevel(e) {
|
|
133
|
-
Ee.instance.setLevel(e);
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* @method setLevel
|
|
137
|
-
* @description Updates the current log level.
|
|
138
|
-
* @description 現在のログレベルを更新します。
|
|
139
|
-
* @param {LogLevel} level - The new log level.
|
|
140
|
-
*/
|
|
141
|
-
setLevel(e) {
|
|
142
|
-
this.level = e;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* @method setImplementation
|
|
146
|
-
* @description Updates the logger implementation for the static instance.
|
|
147
|
-
* @description 静的インスタンスのロガーの実装を更新します。
|
|
148
|
-
* @param {ILogger} impl - The new logger implementation.
|
|
149
|
-
*/
|
|
150
|
-
static setImplementation(e) {
|
|
151
|
-
Ee.instance.setImplementation(e);
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* @method setImplementation
|
|
155
|
-
* @description Updates the logger implementation.
|
|
156
|
-
* @description ロガーの実装を更新します。
|
|
157
|
-
* @param {ILogger} impl - The new logger implementation.
|
|
158
|
-
*/
|
|
159
|
-
setImplementation(e) {
|
|
160
|
-
this.impl = e;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* @method setPrefix
|
|
164
|
-
* @description Updates the log prefix for the static instance.
|
|
165
|
-
* @description 静的インスタンスのログのプレフィックスを更新します。
|
|
166
|
-
* @param {string} prefix - The new prefix.
|
|
167
|
-
*/
|
|
168
|
-
static setPrefix(e) {
|
|
169
|
-
Ee.instance.setPrefix(e);
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* @method setPrefix
|
|
173
|
-
* @description Updates the log prefix.
|
|
174
|
-
* @description ログのプレフィックスを更新します。
|
|
175
|
-
* @param {string} prefix - The new prefix.
|
|
176
|
-
*/
|
|
177
|
-
setPrefix(e) {
|
|
178
|
-
this.prefix = e;
|
|
179
|
-
}
|
|
180
|
-
formatMessage(e) {
|
|
181
|
-
return typeof e == "string" ? [`${this.prefix} ${e}`] : [this.prefix, e];
|
|
182
|
-
}
|
|
183
|
-
static debug(e, ...n) {
|
|
184
|
-
Ee.instance.debug(e, ...n);
|
|
185
|
-
}
|
|
186
|
-
debug(e, ...n) {
|
|
187
|
-
this.level <= 0 && this.impl.debug(...this.formatMessage(e), ...n);
|
|
188
|
-
}
|
|
189
|
-
static info(e, ...n) {
|
|
190
|
-
Ee.instance.info(e, ...n);
|
|
191
|
-
}
|
|
192
|
-
info(e, ...n) {
|
|
193
|
-
this.level <= 1 && this.impl.info(...this.formatMessage(e), ...n);
|
|
194
|
-
}
|
|
195
|
-
static warn(e, ...n) {
|
|
196
|
-
Ee.instance.warn(e, ...n);
|
|
197
|
-
}
|
|
198
|
-
warn(e, ...n) {
|
|
199
|
-
this.level <= 2 && this.impl.warn(...this.formatMessage(e), ...n);
|
|
200
|
-
}
|
|
201
|
-
static error(e, ...n) {
|
|
202
|
-
Ee.instance.error(e, ...n);
|
|
203
|
-
}
|
|
204
|
-
error(e, ...n) {
|
|
205
|
-
this.level <= 3 && this.impl.error(...this.formatMessage(e), ...n);
|
|
206
|
-
}
|
|
207
|
-
};
|
|
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
|
-
id: e.id,
|
|
212
|
-
size: e.size,
|
|
213
|
-
percentageSize: e.percentageSize,
|
|
214
|
-
preferredPercentageSize: e.preferredPercentageSize,
|
|
215
|
-
sizeBeforeCollapse: e.sizeBeforeCollapse,
|
|
216
|
-
percentageSizeBeforeCollapse: e.percentageSizeBeforeCollapse,
|
|
217
|
-
preferredPercentageSizeBeforeCollapse: e.preferredPercentageSizeBeforeCollapse,
|
|
218
|
-
measuredPercentageSize: e.measuredPercentageSize,
|
|
219
|
-
excludeFromAutoGrowth: e.excludeFromAutoGrowth ?? !1,
|
|
220
|
-
collapsed: e.collapsed ?? !1,
|
|
221
|
-
collapseFromStart: e.collapseFromStart,
|
|
222
|
-
collapseFromEnd: e.collapseFromEnd,
|
|
223
|
-
collapsedByDirection: e.collapsedByDirection ?? null
|
|
224
|
-
})), Ye = (t) => t ? ve([t])[0] : null, De = (t) => t ? !!(t.collapseFromStart || t.collapseFromEnd) : !1, Ke = (t, e) => {
|
|
225
|
-
if (!Number.isFinite(e) || e <= 0)
|
|
226
|
-
return t;
|
|
227
|
-
const n = t.map((u) => ({ ...u })), d = [];
|
|
228
|
-
for (let u = 0; u < n.length; u += 1) {
|
|
229
|
-
const z = n[u];
|
|
230
|
-
if (z.collapsed) {
|
|
231
|
-
n[u] = {
|
|
232
|
-
...z,
|
|
233
|
-
size: 0,
|
|
234
|
-
percentageSize: 0
|
|
235
|
-
};
|
|
236
|
-
continue;
|
|
237
|
-
}
|
|
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
|
-
if (v) {
|
|
241
|
-
const D = z.preferredPixelSize ?? z.size ?? z.originalPixelSize ?? o;
|
|
242
|
-
C = me(D, o, m);
|
|
243
|
-
} else {
|
|
244
|
-
const D = z.preferredPercentageSize ?? z.percentageSize ?? Ce(z.size, e), X = We(D, e);
|
|
245
|
-
C = me(X, o, m);
|
|
246
|
-
}
|
|
247
|
-
const S = !v && (z.excludeFromAutoGrowth ?? !1) && x <= h;
|
|
248
|
-
d.push({
|
|
249
|
-
index: u,
|
|
250
|
-
isPixelPanel: v,
|
|
251
|
-
minSize: o,
|
|
252
|
-
maxSize: m,
|
|
253
|
-
preferredSize: C,
|
|
254
|
-
priority: z.pixelAdjustPriority ?? u + 1,
|
|
255
|
-
flexPriority: v ? void 0 : z.flexAdjustPriority,
|
|
256
|
-
excludeFromGrowth: S
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
if (d.length === 0)
|
|
260
|
-
return n;
|
|
261
|
-
const r = /* @__PURE__ */ new Map();
|
|
262
|
-
let c = 0;
|
|
263
|
-
for (const u of d)
|
|
264
|
-
r.set(u.index, u.minSize), c += u.minSize;
|
|
265
|
-
let i = e - c;
|
|
266
|
-
const p = (u, z) => {
|
|
267
|
-
if (z <= 0)
|
|
268
|
-
return 0;
|
|
269
|
-
const s = r.get(u.index) ?? u.minSize, a = Math.max(0, u.maxSize - s);
|
|
270
|
-
if (a <= 0)
|
|
271
|
-
return 0;
|
|
272
|
-
const o = Math.min(z, a);
|
|
273
|
-
return r.set(u.index, s + o), o;
|
|
274
|
-
};
|
|
275
|
-
if (i > 0) {
|
|
276
|
-
const u = (s) => {
|
|
277
|
-
for (; i > 1e-6; ) {
|
|
278
|
-
let o = 0;
|
|
279
|
-
const h = [];
|
|
280
|
-
for (const v of s) {
|
|
281
|
-
if (!v.isPixelPanel && v.excludeFromGrowth)
|
|
282
|
-
continue;
|
|
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
|
-
}
|
|
286
|
-
if (h.length === 0 || o <= 1e-6)
|
|
287
|
-
break;
|
|
288
|
-
let b = 0;
|
|
289
|
-
const m = i;
|
|
290
|
-
for (const v of h) {
|
|
291
|
-
if (i <= 1e-6)
|
|
292
|
-
break;
|
|
293
|
-
if (!v.descriptor.isPixelPanel && v.descriptor.excludeFromGrowth)
|
|
294
|
-
continue;
|
|
295
|
-
const x = m * v.capacity / o, C = Math.min(v.capacity, x);
|
|
296
|
-
if (C <= 0)
|
|
297
|
-
continue;
|
|
298
|
-
const S = p(v.descriptor, C);
|
|
299
|
-
S > 0 && (i -= S, b += S);
|
|
300
|
-
}
|
|
301
|
-
if (b <= 1e-6)
|
|
302
|
-
break;
|
|
303
|
-
}
|
|
304
|
-
}, z = d.filter((s) => s.isPixelPanel);
|
|
305
|
-
z.sort((s, a) => a.priority - s.priority);
|
|
306
|
-
for (const s of z) {
|
|
307
|
-
if (i <= 0)
|
|
308
|
-
break;
|
|
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
|
-
continue;
|
|
312
|
-
const b = p(s, Math.min(h, i));
|
|
313
|
-
b > 0 && (i -= b);
|
|
314
|
-
}
|
|
315
|
-
if (i > 0) {
|
|
316
|
-
const s = d.filter((a) => !a.isPixelPanel);
|
|
317
|
-
if (s.length > 0) {
|
|
318
|
-
const a = s.filter((o) => o.flexPriority !== void 0 && !o.excludeFromGrowth);
|
|
319
|
-
if (a.length > 0) {
|
|
320
|
-
a.sort((o, h) => (h.flexPriority ?? 0) - (o.flexPriority ?? 0));
|
|
321
|
-
for (const o of a) {
|
|
322
|
-
if (i <= 0)
|
|
323
|
-
break;
|
|
324
|
-
if (o.excludeFromGrowth)
|
|
325
|
-
continue;
|
|
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
|
-
continue;
|
|
329
|
-
const v = p(o, Math.min(m, i));
|
|
330
|
-
v > 0 && (i -= v);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
if (i > 0) {
|
|
334
|
-
const o = a.length > 0 ? s.filter((h) => h.flexPriority === void 0 && !h.excludeFromGrowth) : s.filter((h) => !h.excludeFromGrowth);
|
|
335
|
-
o.length > 0 && u(o);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
if (i > 0) {
|
|
341
|
-
let u = i;
|
|
342
|
-
for (; ; ) {
|
|
343
|
-
let z = 0;
|
|
344
|
-
const s = [];
|
|
345
|
-
for (const o of d) {
|
|
346
|
-
if (!o.isPixelPanel && o.excludeFromGrowth)
|
|
347
|
-
continue;
|
|
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
|
-
}
|
|
351
|
-
if (z <= 0)
|
|
352
|
-
break;
|
|
353
|
-
const a = i;
|
|
354
|
-
for (const o of s) {
|
|
355
|
-
if (i <= 0)
|
|
356
|
-
break;
|
|
357
|
-
if (!o.isPixelPanel && o.excludeFromGrowth)
|
|
358
|
-
continue;
|
|
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
|
-
continue;
|
|
362
|
-
const v = a * m / z, x = p(o, Math.min(m, v));
|
|
363
|
-
x > 0 && (i -= x);
|
|
364
|
-
}
|
|
365
|
-
if (i <= 1e-6 || Math.abs(u - i) <= 1e-6)
|
|
366
|
-
break;
|
|
367
|
-
u = i;
|
|
368
|
-
}
|
|
369
|
-
i = Math.max(0, i);
|
|
370
|
-
}
|
|
371
|
-
if (i < 0) {
|
|
372
|
-
let u = i;
|
|
373
|
-
const z = d.filter((s) => s.isPixelPanel);
|
|
374
|
-
for (z.sort((s, a) => s.priority - a.priority); !(i >= 0); ) {
|
|
375
|
-
let s = !1;
|
|
376
|
-
for (const a of z) {
|
|
377
|
-
if (i >= 0)
|
|
378
|
-
break;
|
|
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
|
-
r.set(a.index, o - v), i += v, s = !0;
|
|
383
|
-
continue;
|
|
384
|
-
}
|
|
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
|
-
r.set(a.index, o - v), i += v, s = !0;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
if (!s || Math.abs(u - i) <= 1e-6)
|
|
392
|
-
break;
|
|
393
|
-
u = i;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
for (const u of d) {
|
|
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
|
-
n[u.index] = {
|
|
399
|
-
...s,
|
|
400
|
-
size: z,
|
|
401
|
-
percentageSize: b,
|
|
402
|
-
preferredPercentageSize: s.preferredPercentageSize,
|
|
403
|
-
preferredPixelSize: u.isPixelPanel ? s.preferredPixelSize ?? z : s.preferredPixelSize,
|
|
404
|
-
sizeBeforeCollapse: o,
|
|
405
|
-
measuredPixelSizeBeforeCollapse: h,
|
|
406
|
-
measuredPixelSize: void 0,
|
|
407
|
-
measuredPercentageSize: void 0
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
return Le(n);
|
|
411
|
-
}, Le = (t) => {
|
|
412
|
-
let e = 0;
|
|
413
|
-
for (const r of t)
|
|
414
|
-
r.collapsed || (e += Math.max(r.size, 0));
|
|
415
|
-
if (e <= 0) {
|
|
416
|
-
let r = !1;
|
|
417
|
-
const c = t.map((i) => (i.percentageSize ?? 0) !== 0 ? (r = !0, {
|
|
418
|
-
...i,
|
|
419
|
-
percentageSize: 0,
|
|
420
|
-
measuredPercentageSize: i.measuredPercentageSize !== void 0 ? 0 : i.measuredPercentageSize
|
|
421
|
-
}) : !i.collapsed && i.sizeBeforeCollapse !== i.size ? (r = !0, {
|
|
422
|
-
...i,
|
|
423
|
-
sizeBeforeCollapse: i.size
|
|
424
|
-
}) : i);
|
|
425
|
-
return r ? c : t;
|
|
426
|
-
}
|
|
427
|
-
let n = !1;
|
|
428
|
-
const d = t.map((r) => {
|
|
429
|
-
if (r.collapsed)
|
|
430
|
-
return (r.percentageSize ?? 0) !== 0 ? (n = !0, {
|
|
431
|
-
...r,
|
|
432
|
-
percentageSize: 0,
|
|
433
|
-
measuredPercentageSize: r.measuredPercentageSize !== void 0 ? 0 : r.measuredPercentageSize
|
|
434
|
-
}) : r;
|
|
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
|
-
return r;
|
|
438
|
-
n = !0;
|
|
439
|
-
const C = m ? r.size : r.sizeBeforeCollapse, S = x ? v : r.measuredPixelSizeBeforeCollapse;
|
|
440
|
-
return {
|
|
441
|
-
...r,
|
|
442
|
-
percentageSize: s,
|
|
443
|
-
sizeBeforeCollapse: C,
|
|
444
|
-
measuredPixelSizeBeforeCollapse: S,
|
|
445
|
-
collapsedByDirection: r.collapsed ? r.collapsedByDirection ?? null : null
|
|
446
|
-
};
|
|
447
|
-
});
|
|
448
|
-
return n ? d : t;
|
|
449
|
-
}, Ze = (t, e) => {
|
|
450
|
-
if (e <= 0)
|
|
451
|
-
return !1;
|
|
452
|
-
const n = [];
|
|
453
|
-
let d = 0;
|
|
454
|
-
for (let s = 0; s < t.length; s += 1) {
|
|
455
|
-
const a = t[s];
|
|
456
|
-
!a || a.collapsed || (n.push(s), d += a.size);
|
|
457
|
-
}
|
|
458
|
-
if (n.length === 0)
|
|
459
|
-
return !1;
|
|
460
|
-
let r = e - d;
|
|
461
|
-
if (Math.abs(r) <= 0)
|
|
462
|
-
return !1;
|
|
463
|
-
let c = !1;
|
|
464
|
-
const i = (s) => {
|
|
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
|
-
return {
|
|
467
|
-
index: s,
|
|
468
|
-
minSize: b,
|
|
469
|
-
maxSize: m,
|
|
470
|
-
isFlexible: v
|
|
471
|
-
};
|
|
472
|
-
}, p = (s, a) => {
|
|
473
|
-
if (!Number.isFinite(a) || Math.abs(a) <= 0)
|
|
474
|
-
return;
|
|
475
|
-
const o = t[s];
|
|
476
|
-
if (!o)
|
|
477
|
-
return;
|
|
478
|
-
const h = Math.max(0, o.size + a);
|
|
479
|
-
if (Math.abs(h - o.size) <= 0)
|
|
480
|
-
return;
|
|
481
|
-
const b = Ce(h, e), m = De(o), v = m ? h : o.sizeBeforeCollapse, x = m ? o.measuredPixelSizeBeforeCollapse ?? o.measuredPixelSize ?? h : o.measuredPixelSizeBeforeCollapse;
|
|
482
|
-
t[s] = {
|
|
483
|
-
...o,
|
|
484
|
-
size: h,
|
|
485
|
-
percentageSize: b,
|
|
486
|
-
sizeBeforeCollapse: v,
|
|
487
|
-
measuredPixelSizeBeforeCollapse: x,
|
|
488
|
-
measuredPixelSize: void 0,
|
|
489
|
-
measuredPercentageSize: void 0
|
|
490
|
-
}, r -= a, c = !0;
|
|
491
|
-
}, u = (s) => {
|
|
492
|
-
for (const a of s) {
|
|
493
|
-
if (Math.abs(r) <= 0)
|
|
494
|
-
break;
|
|
495
|
-
const o = t[a.index];
|
|
496
|
-
if (!o || o.collapsed)
|
|
497
|
-
continue;
|
|
498
|
-
const h = o.size;
|
|
499
|
-
if (r > 0) {
|
|
500
|
-
const b = Math.max(0, a.maxSize - h);
|
|
501
|
-
if (b <= 0)
|
|
502
|
-
continue;
|
|
503
|
-
const m = Math.min(b, r);
|
|
504
|
-
if (m <= 0)
|
|
505
|
-
continue;
|
|
506
|
-
p(a.index, m);
|
|
507
|
-
} else {
|
|
508
|
-
const b = Math.max(0, h - a.minSize);
|
|
509
|
-
if (b <= 0)
|
|
510
|
-
continue;
|
|
511
|
-
const m = Math.min(b, Math.abs(r));
|
|
512
|
-
if (m <= 0)
|
|
513
|
-
continue;
|
|
514
|
-
p(a.index, -m);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}, z = n.map((s) => i(s)).filter((s) => s.isFlexible);
|
|
518
|
-
if (z.length > 0 && u(z), Math.abs(r) > 0) {
|
|
519
|
-
const s = r;
|
|
520
|
-
r = Ct(t, r, e, { enforceAutoMinSize: !0 }), Math.abs(r - s) > 0 && (c = !0);
|
|
521
|
-
}
|
|
522
|
-
return c;
|
|
523
|
-
}, at = (t, e, n) => {
|
|
524
|
-
if (!(t.sizeUnit === "pixels" || t.originalPixelSize !== void 0) || t.pixelAdjustPriority !== void 0)
|
|
525
|
-
return t;
|
|
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
|
-
return {
|
|
528
|
-
...t,
|
|
529
|
-
pixelAdjustPriority: c
|
|
530
|
-
};
|
|
531
|
-
}, Dt = (t, e) => {
|
|
532
|
-
switch (e.type) {
|
|
533
|
-
case "REGISTER_PANEL": {
|
|
534
|
-
ze.debug("REGISTER_PANEL", e.panel);
|
|
535
|
-
const n = t.findIndex((c) => c.id === e.panel.id);
|
|
536
|
-
if (n >= 0) {
|
|
537
|
-
const c = [...t], i = t[n], p = {
|
|
538
|
-
...i,
|
|
539
|
-
minSize: e.panel.minSize,
|
|
540
|
-
maxSize: e.panel.maxSize,
|
|
541
|
-
collapseFromStart: e.panel.collapseFromStart,
|
|
542
|
-
collapseFromEnd: e.panel.collapseFromEnd,
|
|
543
|
-
collapsedByDirection: e.panel.collapsedByDirection !== void 0 ? e.panel.collapsedByDirection : i.collapsedByDirection,
|
|
544
|
-
sizeUnit: e.panel.sizeUnit,
|
|
545
|
-
originalPixelSize: e.panel.originalPixelSize,
|
|
546
|
-
preferredPercentageSize: e.panel.preferredPercentageSize !== void 0 ? e.panel.preferredPercentageSize : i.preferredPercentageSize,
|
|
547
|
-
preferredPercentageSizeBeforeCollapse: e.panel.preferredPercentageSizeBeforeCollapse !== void 0 ? e.panel.preferredPercentageSizeBeforeCollapse : i.preferredPercentageSizeBeforeCollapse,
|
|
548
|
-
percentageSizeBeforeCollapse: e.panel.percentageSizeBeforeCollapse !== void 0 ? e.panel.percentageSizeBeforeCollapse : i.percentageSizeBeforeCollapse,
|
|
549
|
-
pixelAdjustPriority: e.panel.pixelAdjustPriority !== void 0 ? e.panel.pixelAdjustPriority : i.pixelAdjustPriority,
|
|
550
|
-
autoMinSize: e.panel.autoMinSize !== void 0 ? e.panel.autoMinSize : i.autoMinSize,
|
|
551
|
-
excludeFromAutoGrowth: e.panel.excludeFromAutoGrowth !== void 0 ? e.panel.excludeFromAutoGrowth : i.excludeFromAutoGrowth
|
|
552
|
-
}, u = at(p, t, n);
|
|
553
|
-
return ze.debug("register panel (update)", {
|
|
554
|
-
panelId: u.id,
|
|
555
|
-
incoming: Ye(e.panel),
|
|
556
|
-
previous: Ye(i),
|
|
557
|
-
next: Ye(u)
|
|
558
|
-
}), c[n] = u, c;
|
|
559
|
-
}
|
|
560
|
-
const d = { ...e.panel }, r = at(d, t);
|
|
561
|
-
return ze.debug("register panel (insert)", {
|
|
562
|
-
panelId: r.id,
|
|
563
|
-
incoming: Ye(r),
|
|
564
|
-
previousLength: t.length
|
|
565
|
-
}), [...t, r];
|
|
566
|
-
}
|
|
567
|
-
case "UNREGISTER_PANEL": {
|
|
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
|
-
panelId: e.id,
|
|
572
|
-
previous: ve(t),
|
|
573
|
-
filtered: ve(n),
|
|
574
|
-
next: ve(d)
|
|
575
|
-
}), d;
|
|
576
|
-
}
|
|
577
|
-
case "RESIZE_PANELS": {
|
|
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
|
-
if (n === -1 || d === -1) return t;
|
|
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
|
-
return t;
|
|
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
|
-
return t;
|
|
599
|
-
const le = me(e.leftSize, G.min, G.max), P = S - le;
|
|
600
|
-
if (P < s || P > a)
|
|
601
|
-
return t;
|
|
602
|
-
_ = le, E = P;
|
|
603
|
-
} else {
|
|
604
|
-
const G = X(S);
|
|
605
|
-
if (G.min > G.max)
|
|
606
|
-
return t;
|
|
607
|
-
const le = me(e.rightSize, G.min, G.max), P = S - le;
|
|
608
|
-
if (P < u || P > z)
|
|
609
|
-
return t;
|
|
610
|
-
E = le, _ = P;
|
|
611
|
-
}
|
|
612
|
-
const oe = _ + E;
|
|
613
|
-
if (S !== oe)
|
|
614
|
-
return t;
|
|
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
|
-
return r[n] = {
|
|
620
|
-
...c,
|
|
621
|
-
size: _,
|
|
622
|
-
percentageSize: O,
|
|
623
|
-
preferredPercentageSize: O > 0 ? O : c.preferredPercentageSize,
|
|
624
|
-
preferredPixelSize: y,
|
|
625
|
-
sizeBeforeCollapse: Be ? _ : c.sizeBeforeCollapse,
|
|
626
|
-
measuredPixelSize: void 0,
|
|
627
|
-
measuredPercentageSize: void 0,
|
|
628
|
-
excludeFromAutoGrowth: ge
|
|
629
|
-
}, r[d] = {
|
|
630
|
-
...i,
|
|
631
|
-
size: E,
|
|
632
|
-
percentageSize: Y,
|
|
633
|
-
preferredPercentageSize: Y > 0 ? Y : i.preferredPercentageSize,
|
|
634
|
-
preferredPixelSize: N,
|
|
635
|
-
sizeBeforeCollapse: Re ? E : i.sizeBeforeCollapse,
|
|
636
|
-
measuredPixelSize: void 0,
|
|
637
|
-
measuredPercentageSize: void 0,
|
|
638
|
-
excludeFromAutoGrowth: ye
|
|
639
|
-
}, p > 0 && Ze(r, p) ? Le(r) : r;
|
|
640
|
-
}
|
|
641
|
-
case "SET_PANELS": {
|
|
642
|
-
ze.debug("SET_PANELS", e.panels);
|
|
643
|
-
const n = e.panels.map((u) => {
|
|
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
|
-
return {
|
|
646
|
-
...u,
|
|
647
|
-
preferredPercentageSize: s,
|
|
648
|
-
preferredPixelSize: a
|
|
649
|
-
};
|
|
650
|
-
}), d = ve(t), r = ve(n), c = Le(n), i = ve(c);
|
|
651
|
-
let p = d.length === i.length;
|
|
652
|
-
if (p)
|
|
653
|
-
for (let u = 0; u < i.length; u += 1) {
|
|
654
|
-
const z = i[u], s = d[u];
|
|
655
|
-
if (!s) {
|
|
656
|
-
p = !1;
|
|
657
|
-
break;
|
|
658
|
-
}
|
|
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
|
-
p = !1;
|
|
661
|
-
break;
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
return p ? (ze.debug("set panels skipped (no diff)", {
|
|
665
|
-
previous: d,
|
|
666
|
-
incoming: r,
|
|
667
|
-
next: i,
|
|
668
|
-
previousLength: d.length,
|
|
669
|
-
incomingLength: r.length
|
|
670
|
-
}), t) : (ze.debug("set panels", {
|
|
671
|
-
previous: d,
|
|
672
|
-
incoming: r,
|
|
673
|
-
next: i,
|
|
674
|
-
previousLength: d.length,
|
|
675
|
-
incomingLength: r.length
|
|
676
|
-
}), c);
|
|
677
|
-
}
|
|
678
|
-
case "CONTAINER_RESIZED": {
|
|
679
|
-
if (ze.debug("CONTAINER_RESIZED", e.containerSize), e.containerSize <= 0)
|
|
680
|
-
return ze.debug("container resized skipped (non-positive size)", {
|
|
681
|
-
containerSize: e.containerSize,
|
|
682
|
-
panels: ve(t)
|
|
683
|
-
}), t;
|
|
684
|
-
ze.debug("container resized (before)", {
|
|
685
|
-
containerSize: e.containerSize,
|
|
686
|
-
panels: ve(t)
|
|
687
|
-
});
|
|
688
|
-
const n = Ke(t, e.containerSize);
|
|
689
|
-
if (ze.debug("container resized (after recalc)", {
|
|
690
|
-
containerSize: e.containerSize,
|
|
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
|
-
containerSize: e.containerSize,
|
|
696
|
-
panels: ve(d)
|
|
697
|
-
}), d;
|
|
698
|
-
}
|
|
699
|
-
return ze.debug("container resized (final)", {
|
|
700
|
-
containerSize: e.containerSize,
|
|
701
|
-
panels: ve(n)
|
|
702
|
-
}), n;
|
|
703
|
-
}
|
|
704
|
-
case "COLLAPSE_PANEL": {
|
|
705
|
-
ze.debug("COLLAPSE_PANEL", e.id);
|
|
706
|
-
const n = t.findIndex((o) => o.id === e.id);
|
|
707
|
-
if (n === -1)
|
|
708
|
-
return t;
|
|
709
|
-
const d = t[n], r = e.from === "start" ? d.collapseFromStart : d.collapseFromEnd;
|
|
710
|
-
if (!(De(d) && r) || d.collapsed)
|
|
711
|
-
return t;
|
|
712
|
-
const i = d.size, p = d.measuredPixelSize ?? i, u = d.percentageSize ?? d.preferredPercentageSize ?? 0, z = {
|
|
713
|
-
...d,
|
|
714
|
-
collapsed: !0,
|
|
715
|
-
collapsedByDirection: e.from,
|
|
716
|
-
sizeBeforeCollapse: i,
|
|
717
|
-
percentageSizeBeforeCollapse: u,
|
|
718
|
-
preferredPercentageSizeBeforeCollapse: d.preferredPercentageSize ?? u,
|
|
719
|
-
preferredPixelSizeBeforeCollapse: d.preferredPixelSize ?? i,
|
|
720
|
-
measuredPixelSizeBeforeCollapse: p,
|
|
721
|
-
size: 0,
|
|
722
|
-
percentageSize: 0,
|
|
723
|
-
preferredPercentageSize: d.preferredPercentageSize,
|
|
724
|
-
measuredPixelSize: d.measuredPixelSize !== void 0 ? 0 : d.measuredPixelSize,
|
|
725
|
-
measuredPercentageSize: d.measuredPercentageSize !== void 0 ? 0 : d.measuredPercentageSize
|
|
726
|
-
}, s = [...t];
|
|
727
|
-
s[n] = z;
|
|
728
|
-
const a = Ke(s, e.containerSize);
|
|
729
|
-
return e.containerSize > 0 && Ze(a, e.containerSize) ? Le(a) : a;
|
|
730
|
-
}
|
|
731
|
-
case "EXPAND_PANEL": {
|
|
732
|
-
ze.debug("EXPAND_PANEL", e.id, e.targetSize);
|
|
733
|
-
const n = t.findIndex((S) => S.id === e.id);
|
|
734
|
-
if (n === -1)
|
|
735
|
-
return t;
|
|
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
|
-
return t;
|
|
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
|
-
...r,
|
|
741
|
-
collapsed: !1,
|
|
742
|
-
collapsedByDirection: null,
|
|
743
|
-
size: s,
|
|
744
|
-
percentageSize: a,
|
|
745
|
-
preferredPercentageSize: b,
|
|
746
|
-
preferredPixelSize: m,
|
|
747
|
-
sizeBeforeCollapse: s,
|
|
748
|
-
percentageSizeBeforeCollapse: void 0,
|
|
749
|
-
preferredPercentageSizeBeforeCollapse: void 0,
|
|
750
|
-
preferredPixelSizeBeforeCollapse: void 0,
|
|
751
|
-
measuredPixelSize: s,
|
|
752
|
-
measuredPixelSizeBeforeCollapse: o,
|
|
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
|
-
}
|
|
759
|
-
default:
|
|
760
|
-
return t;
|
|
761
|
-
}
|
|
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
|
-
return;
|
|
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
|
-
return;
|
|
780
|
-
}
|
|
781
|
-
if (l && !h && U.current) {
|
|
782
|
-
V.current = null;
|
|
783
|
-
const g = ce(U.current);
|
|
784
|
-
i({ type: "SET_PANELS", panels: g });
|
|
785
|
-
return;
|
|
786
|
-
}
|
|
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));
|
|
799
|
-
}
|
|
800
|
-
});
|
|
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 });
|
|
811
|
-
}
|
|
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")
|
|
818
|
-
return !1;
|
|
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)))
|
|
823
|
-
return;
|
|
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;
|
|
833
|
-
return {
|
|
834
|
-
...f,
|
|
835
|
-
size: 0,
|
|
836
|
-
percentageSize: 0,
|
|
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
|
|
843
|
-
};
|
|
844
|
-
}
|
|
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
|
|
852
|
-
};
|
|
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;
|
|
856
|
-
}
|
|
857
|
-
return ie;
|
|
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,
|
|
868
|
-
1
|
|
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);
|
|
876
|
-
} else {
|
|
877
|
-
const we = f.percentageSize !== void 0 ? We(f.percentageSize, g) : f.size, Ie = we > 0 ? we : ke;
|
|
878
|
-
Ae = me(Ie, ie, xe);
|
|
879
|
-
}
|
|
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
|
|
885
|
-
};
|
|
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;
|
|
889
|
-
}
|
|
890
|
-
return Te;
|
|
891
|
-
}
|
|
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);
|
|
897
|
-
}
|
|
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;
|
|
913
|
-
if (!g) {
|
|
914
|
-
h && b((R) => !R || R.availableContainerSize === l ? R : {
|
|
915
|
-
reason: R.reason,
|
|
916
|
-
// totalMinimumSize: previous.totalMinimumSize,
|
|
917
|
-
// totalMaximumSize: previous.totalMaximumSize,
|
|
918
|
-
totalMinimumSize: null,
|
|
919
|
-
totalMaximumSize: null,
|
|
920
|
-
availableContainerSize: l
|
|
921
|
-
});
|
|
922
|
-
return;
|
|
923
|
-
}
|
|
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
|
|
931
|
-
};
|
|
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);
|
|
933
|
-
return;
|
|
934
|
-
}
|
|
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);
|
|
938
|
-
}
|
|
939
|
-
}, [c, t, p.width, p.height, h]), se(() => {
|
|
940
|
-
Pe();
|
|
941
|
-
}, [Pe]), se(() => {
|
|
942
|
-
D.current = n;
|
|
943
|
-
}, [n]);
|
|
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);
|
|
951
|
-
}, 200);
|
|
952
|
-
return () => clearTimeout(l);
|
|
953
|
-
}
|
|
954
|
-
}, [d, he]), se(() => {
|
|
955
|
-
if (!d || c.length === 0 || X.current)
|
|
956
|
-
return;
|
|
957
|
-
const l = t === "horizontal" ? p.width : p.height;
|
|
958
|
-
if (l <= 0)
|
|
959
|
-
return;
|
|
960
|
-
const g = Lt(d);
|
|
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;
|
|
964
|
-
return {
|
|
965
|
-
...M,
|
|
966
|
-
size: Z,
|
|
967
|
-
percentageSize: T,
|
|
968
|
-
preferredPercentageSize: T > 0 ? T : M.preferredPercentageSize,
|
|
969
|
-
preferredPixelSize: R
|
|
970
|
-
};
|
|
971
|
-
});
|
|
972
|
-
i({ type: "SET_PANELS", panels: w }), X.current = !0;
|
|
973
|
-
}
|
|
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
|
|
995
|
-
});
|
|
996
|
-
if (w[l.id] === M) {
|
|
997
|
-
Ue.debug("useResizablePanels.registerPanel skipped", {
|
|
998
|
-
panelId: l.id,
|
|
999
|
-
reason: "duplicate-registration"
|
|
1000
|
-
});
|
|
1001
|
-
return;
|
|
1002
|
-
}
|
|
1003
|
-
w[l.id] = M, Ue.debug("useResizablePanels.registerPanel", {
|
|
1004
|
-
panelId: l.id,
|
|
1005
|
-
containerReady: _.current,
|
|
1006
|
-
violationReason: E.current,
|
|
1007
|
-
containerSize: {
|
|
1008
|
-
width: g.width,
|
|
1009
|
-
height: g.height
|
|
1010
|
-
}
|
|
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,
|
|
1018
|
-
containerSize: {
|
|
1019
|
-
width: g.width,
|
|
1020
|
-
height: g.height
|
|
1021
|
-
}
|
|
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;
|
|
1027
|
-
});
|
|
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 });
|
|
1033
|
-
return;
|
|
1034
|
-
}
|
|
1035
|
-
if (B.collapsed || H.collapsed)
|
|
1036
|
-
return;
|
|
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;
|
|
1047
|
-
}
|
|
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;
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
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 });
|
|
1057
|
-
},
|
|
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 });
|
|
1063
|
-
},
|
|
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 });
|
|
1069
|
-
},
|
|
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) => {
|
|
1076
|
-
if (g === null) {
|
|
1077
|
-
if (!(l in w))
|
|
1078
|
-
return w;
|
|
1079
|
-
const H = { ...w };
|
|
1080
|
-
return delete H[l], H;
|
|
1081
|
-
}
|
|
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
|
-
});
|
|
1093
|
-
});
|
|
1094
|
-
}, []), le = Se((l, g) => {
|
|
1095
|
-
C((w) => {
|
|
1096
|
-
if (g === null) {
|
|
1097
|
-
if (!(l in w))
|
|
1098
|
-
return w;
|
|
1099
|
-
const A = { ...w };
|
|
1100
|
-
return delete A[l], A;
|
|
1101
|
-
}
|
|
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
|
|
1106
|
-
};
|
|
1107
|
-
});
|
|
1108
|
-
}, []), P = ae(
|
|
1109
|
-
() => ({
|
|
1110
|
-
direction: t,
|
|
1111
|
-
panels: c,
|
|
1112
|
-
containerSize: p,
|
|
1113
|
-
isContainerReady: z,
|
|
1114
|
-
showDebugInfo: r,
|
|
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
|
|
1126
|
-
}),
|
|
1127
|
-
[t, c, p, z, r, ue, pe, ge, ye, Be, Re, G, m, le, x, h]
|
|
1128
|
-
), $ = ae(
|
|
1129
|
-
() => ({
|
|
1130
|
-
display: "flex",
|
|
1131
|
-
flexDirection: t === "horizontal" ? "row" : "column",
|
|
1132
|
-
alignItems: "stretch",
|
|
1133
|
-
width: "100%",
|
|
1134
|
-
height: "100%",
|
|
1135
|
-
minWidth: "0px",
|
|
1136
|
-
minHeight: "0px",
|
|
1137
|
-
position: "relative",
|
|
1138
|
-
overflow: "hidden",
|
|
1139
|
-
// リサイズハンドルのはみ出しでスクロールバーを表示させない
|
|
1140
|
-
...e
|
|
1141
|
-
}),
|
|
1142
|
-
[t, e]
|
|
1143
|
-
);
|
|
1144
|
-
return {
|
|
1145
|
-
groupRef: S,
|
|
1146
|
-
contextValue: P,
|
|
1147
|
-
groupStyle: $
|
|
1148
|
-
};
|
|
1149
|
-
}, di = (t) => {
|
|
1150
|
-
const { getPanel: e, collapsePanel: n, expandPanel: d } = rt(), r = e(t), c = Se(
|
|
1151
|
-
(u) => {
|
|
1152
|
-
n(t, u);
|
|
1153
|
-
},
|
|
1154
|
-
[n, t]
|
|
1155
|
-
), i = Se(
|
|
1156
|
-
(u, z) => {
|
|
1157
|
-
d(t, u, z);
|
|
1158
|
-
},
|
|
1159
|
-
[d, t]
|
|
1160
|
-
), p = Se(
|
|
1161
|
-
(u, z) => {
|
|
1162
|
-
r?.collapsed ? i(u, z) : c(u);
|
|
1163
|
-
},
|
|
1164
|
-
[r?.collapsed, c, i]
|
|
1165
|
-
);
|
|
1166
|
-
return ae(
|
|
1167
|
-
() => ({
|
|
1168
|
-
panel: r,
|
|
1169
|
-
isCollapsed: r?.collapsed ?? !1,
|
|
1170
|
-
canCollapseFromStart: r?.collapseFromStart ?? !1,
|
|
1171
|
-
canCollapseFromEnd: r?.collapseFromEnd ?? !1,
|
|
1172
|
-
collapse: c,
|
|
1173
|
-
expand: i,
|
|
1174
|
-
toggle: p
|
|
1175
|
-
}),
|
|
1176
|
-
[r, c, i, p]
|
|
1177
|
-
);
|
|
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}`];
|
|
1180
|
-
return {
|
|
1181
|
-
stateValueDisplay: a,
|
|
1182
|
-
measuredValueDisplay: o,
|
|
1183
|
-
containerDisplay: s,
|
|
1184
|
-
headlineLabel: h,
|
|
1185
|
-
titleText: b.join(`
|
|
1186
|
-
`)
|
|
1187
|
-
};
|
|
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({
|
|
1191
|
-
panel: t,
|
|
1192
|
-
measuredPixelSize: e,
|
|
1193
|
-
measuredPercentageSize: n,
|
|
1194
|
-
containerAxisSize: d,
|
|
1195
|
-
containerLabel: c
|
|
1196
|
-
}),
|
|
1197
|
-
[t, e, n, d, c]
|
|
1198
|
-
), a = {
|
|
1199
|
-
position: "absolute",
|
|
1200
|
-
top: "2px",
|
|
1201
|
-
right: "4px",
|
|
1202
|
-
backgroundColor: "rgba(30, 41, 59, 0.6)",
|
|
1203
|
-
color: "#fff",
|
|
1204
|
-
padding: "4px 8px",
|
|
1205
|
-
borderRadius: "6px",
|
|
1206
|
-
fontSize: "11px",
|
|
1207
|
-
fontFamily: "monospace",
|
|
1208
|
-
pointerEvents: "auto",
|
|
1209
|
-
zIndex: 10,
|
|
1210
|
-
boxShadow: "0 2px 4px rgba(0,0,0,0.3)",
|
|
1211
|
-
border: "1px solid rgba(255,255,255,0.1)",
|
|
1212
|
-
maxWidth: "calc(100% - 12px)",
|
|
1213
|
-
minWidth: "60px",
|
|
1214
|
-
width: "fit-content",
|
|
1215
|
-
overflow: "hidden"
|
|
1216
|
-
}, o = {
|
|
1217
|
-
display: "flex",
|
|
1218
|
-
flexDirection: "column",
|
|
1219
|
-
gap: "1px",
|
|
1220
|
-
minWidth: "0",
|
|
1221
|
-
width: "100%"
|
|
1222
|
-
}, h = {
|
|
1223
|
-
display: "flex",
|
|
1224
|
-
justifyContent: "flex-start",
|
|
1225
|
-
alignItems: "center",
|
|
1226
|
-
gap: "6px",
|
|
1227
|
-
fontSize: "10px",
|
|
1228
|
-
color: "#ccc",
|
|
1229
|
-
whiteSpace: "nowrap",
|
|
1230
|
-
overflow: "hidden",
|
|
1231
|
-
textOverflow: "ellipsis",
|
|
1232
|
-
minWidth: "0",
|
|
1233
|
-
width: "100%"
|
|
1234
|
-
}, b = {
|
|
1235
|
-
display: "flex",
|
|
1236
|
-
justifyContent: "space-between",
|
|
1237
|
-
alignItems: "center",
|
|
1238
|
-
gap: "6px",
|
|
1239
|
-
whiteSpace: "nowrap",
|
|
1240
|
-
overflow: "hidden",
|
|
1241
|
-
textOverflow: "ellipsis",
|
|
1242
|
-
minWidth: "0",
|
|
1243
|
-
width: "100%"
|
|
1244
|
-
}, m = {
|
|
1245
|
-
marginLeft: "auto",
|
|
1246
|
-
fontVariantNumeric: "tabular-nums",
|
|
1247
|
-
whiteSpace: "nowrap"
|
|
1248
|
-
};
|
|
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 })
|
|
1254
|
-
] }),
|
|
1255
|
-
/* @__PURE__ */ fe("div", { style: b, children: [
|
|
1256
|
-
/* @__PURE__ */ I("span", { children: "size (state)" }),
|
|
1257
|
-
/* @__PURE__ */ I("span", { style: m, children: i })
|
|
1258
|
-
] }),
|
|
1259
|
-
/* @__PURE__ */ fe("div", { style: b, children: [
|
|
1260
|
-
/* @__PURE__ */ I("span", { children: "size (measured)" }),
|
|
1261
|
-
/* @__PURE__ */ I("span", { style: m, children: p })
|
|
1262
|
-
] })
|
|
1263
|
-
] }) });
|
|
1264
|
-
}), tt = new je(qe.INFO, "[resize-panels]"), kt = {
|
|
1265
|
-
both: {
|
|
1266
|
-
collapseFromStart: !0,
|
|
1267
|
-
collapseFromEnd: !0
|
|
1268
|
-
},
|
|
1269
|
-
start: {
|
|
1270
|
-
collapseFromStart: !0,
|
|
1271
|
-
collapseFromEnd: !1
|
|
1272
|
-
},
|
|
1273
|
-
end: {
|
|
1274
|
-
collapseFromStart: !1,
|
|
1275
|
-
collapseFromEnd: !0
|
|
1276
|
-
}
|
|
1277
|
-
}, Gt = (t) => {
|
|
1278
|
-
if (!t)
|
|
1279
|
-
return {
|
|
1280
|
-
collapseFromStart: !1,
|
|
1281
|
-
collapseFromEnd: !1
|
|
1282
|
-
};
|
|
1283
|
-
const e = kt[t.from];
|
|
1284
|
-
if (!e)
|
|
1285
|
-
throw new Error("Invalid collapsible configuration: unsupported 'from' value");
|
|
1286
|
-
return e;
|
|
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));
|
|
1295
|
-
return;
|
|
1296
|
-
}
|
|
1297
|
-
r?.current && (clearTimeout(r.current), r.current = null), t.current = i, tt.debug(`commit ${d}`, {
|
|
1298
|
-
panelId: n.current,
|
|
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
|
|
1314
|
-
}),
|
|
1315
|
-
[]
|
|
1316
|
-
), le = ae(
|
|
1317
|
-
() => lt({
|
|
1318
|
-
ref: ye,
|
|
1319
|
-
setState: pe,
|
|
1320
|
-
panelIdRef: j,
|
|
1321
|
-
label: "percentage",
|
|
1322
|
-
timerRef: Re
|
|
1323
|
-
}),
|
|
1324
|
-
[]
|
|
1325
|
-
), P = Se(() => {
|
|
1326
|
-
ge.current !== 0 && (ge.current = 0, he(0)), ye.current !== 0 && (ye.current = 0, pe(0));
|
|
1327
|
-
}, []);
|
|
1328
|
-
se(() => {
|
|
1329
|
-
if (!S)
|
|
1330
|
-
return;
|
|
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;
|
|
1335
|
-
}
|
|
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,
|
|
1346
|
-
minSize: n,
|
|
1347
|
-
maxSize: d,
|
|
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,
|
|
1356
|
-
pixelAdjustPriority: a,
|
|
1357
|
-
flexAdjustPriority: o,
|
|
1358
|
-
autoMinSize: r
|
|
1359
|
-
};
|
|
1360
|
-
m(K);
|
|
1361
|
-
}, [
|
|
1362
|
-
r,
|
|
1363
|
-
_.collapseFromEnd,
|
|
1364
|
-
_.collapseFromStart,
|
|
1365
|
-
s,
|
|
1366
|
-
V,
|
|
1367
|
-
o,
|
|
1368
|
-
E,
|
|
1369
|
-
S,
|
|
1370
|
-
O,
|
|
1371
|
-
d,
|
|
1372
|
-
n,
|
|
1373
|
-
a,
|
|
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)
|
|
1387
|
-
return;
|
|
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);
|
|
1391
|
-
if (ce) {
|
|
1392
|
-
P();
|
|
1393
|
-
return;
|
|
1394
|
-
}
|
|
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
|
|
1402
|
-
});
|
|
1403
|
-
return;
|
|
1404
|
-
}
|
|
1405
|
-
if (L > 0) {
|
|
1406
|
-
G(L), ee > 0 && le(L / ee * 100);
|
|
1407
|
-
return;
|
|
1408
|
-
}
|
|
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();
|
|
1412
|
-
});
|
|
1413
|
-
F.observe(T), R();
|
|
1414
|
-
const k = [], Q = new MutationObserver(() => {
|
|
1415
|
-
(() => {
|
|
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, {
|
|
1422
|
-
childList: !0,
|
|
1423
|
-
subtree: !0,
|
|
1424
|
-
attributes: !0,
|
|
1425
|
-
attributeFilter: ["style", "class"]
|
|
1426
|
-
}), () => {
|
|
1427
|
-
F.disconnect(), Q.disconnect();
|
|
1428
|
-
for (const K of k)
|
|
1429
|
-
clearTimeout(K);
|
|
1430
|
-
};
|
|
1431
|
-
}, [le, G, y, b, ce, P]);
|
|
1432
|
-
const l = y?.size, g = y?.percentageSize, w = y?.sizeUnit;
|
|
1433
|
-
se(() => {
|
|
1434
|
-
if (y) {
|
|
1435
|
-
if (ce) {
|
|
1436
|
-
P();
|
|
1437
|
-
return;
|
|
1438
|
-
}
|
|
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);
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
}, [le, G, y, g, l, w, b, ce, P]), se(() => {
|
|
1453
|
-
D(j.current, {
|
|
1454
|
-
pixelSize: Pe,
|
|
1455
|
-
percentageSize: ue
|
|
1456
|
-
});
|
|
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(),
|
|
1460
|
-
flexGrow: 0,
|
|
1461
|
-
flexShrink: A,
|
|
1462
|
-
overflow: "hidden",
|
|
1463
|
-
position: "relative",
|
|
1464
|
-
boxSizing: "border-box",
|
|
1465
|
-
minHeight: "0px",
|
|
1466
|
-
minWidth: "0px",
|
|
1467
|
-
...i
|
|
1468
|
-
};
|
|
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(
|
|
1471
|
-
() => ({
|
|
1472
|
-
position: "absolute",
|
|
1473
|
-
inset: "0px",
|
|
1474
|
-
overflow: h,
|
|
1475
|
-
display: "flex",
|
|
1476
|
-
flexDirection: "column",
|
|
1477
|
-
width: "100%",
|
|
1478
|
-
height: "100%",
|
|
1479
|
-
minWidth: "0px",
|
|
1480
|
-
minHeight: "0px"
|
|
1481
|
-
}),
|
|
1482
|
-
[h]
|
|
1483
|
-
);
|
|
1484
|
-
return /* @__PURE__ */ fe(
|
|
1485
|
-
"div",
|
|
1486
|
-
{
|
|
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,
|
|
1494
|
-
"data-panel-order": u,
|
|
1495
|
-
"data-panel-collapsible": E,
|
|
1496
|
-
"data-panel-collapse-start": _.collapseFromStart,
|
|
1497
|
-
"data-panel-collapse-end": _.collapseFromEnd,
|
|
1498
|
-
"data-panel-collapsed": y?.collapsed,
|
|
1499
|
-
"aria-hidden": ce,
|
|
1500
|
-
children: [
|
|
1501
|
-
/* @__PURE__ */ I("div", { style: Z, children: p }),
|
|
1502
|
-
C && /* @__PURE__ */ I(_t, { panel: y, measuredPixelSize: Pe, measuredPercentageSize: ue, containerAxisSize: H, direction: b })
|
|
1503
|
-
]
|
|
1504
|
-
}
|
|
1505
|
-
);
|
|
1506
|
-
}
|
|
1507
|
-
), Ht = (t) => JSON.stringify(
|
|
1508
|
-
t.map((e) => ({
|
|
1509
|
-
id: e.id,
|
|
1510
|
-
size: e.size,
|
|
1511
|
-
percentageSize: e.percentageSize ?? null,
|
|
1512
|
-
preferredPercentageSize: e.preferredPercentageSize ?? null,
|
|
1513
|
-
preferredPixelSize: e.preferredPixelSize ?? null,
|
|
1514
|
-
sizeUnit: e.sizeUnit,
|
|
1515
|
-
originalPixelSize: e.originalPixelSize ?? null,
|
|
1516
|
-
minSize: e.minSize ?? null,
|
|
1517
|
-
maxSize: e.maxSize ?? null,
|
|
1518
|
-
autoMinSize: e.autoMinSize ?? null,
|
|
1519
|
-
collapseFromStart: e.collapseFromStart,
|
|
1520
|
-
collapseFromEnd: e.collapseFromEnd,
|
|
1521
|
-
collapsedByDirection: e.collapsedByDirection ?? null,
|
|
1522
|
-
collapsed: e.collapsed ?? !1,
|
|
1523
|
-
sizeBeforeCollapse: e.sizeBeforeCollapse ?? null,
|
|
1524
|
-
preferredPercentageSizeBeforeCollapse: e.preferredPercentageSizeBeforeCollapse ?? null,
|
|
1525
|
-
preferredPixelSizeBeforeCollapse: e.preferredPixelSizeBeforeCollapse ?? null,
|
|
1526
|
-
measuredPixelSizeBeforeCollapse: e.measuredPixelSizeBeforeCollapse ?? null,
|
|
1527
|
-
pixelAdjustPriority: e.pixelAdjustPriority ?? null,
|
|
1528
|
-
flexAdjustPriority: e.flexAdjustPriority ?? null,
|
|
1529
|
-
measuredPixelSize: e.measuredPixelSize ?? null,
|
|
1530
|
-
measuredPercentageSize: e.measuredPercentageSize ?? null
|
|
1531
|
-
}))
|
|
1532
|
-
), Ut = (t) => JSON.stringify(
|
|
1533
|
-
t.map((e) => ({
|
|
1534
|
-
id: e.id,
|
|
1535
|
-
thickness: e.thickness,
|
|
1536
|
-
visible: e.visible,
|
|
1537
|
-
direction: e.direction,
|
|
1538
|
-
startPanelId: e.startPanelId ?? null,
|
|
1539
|
-
endPanelId: e.endPanelId ?? null
|
|
1540
|
-
}))
|
|
1541
|
-
), Wt = () => {
|
|
1542
|
-
const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set();
|
|
1543
|
-
let d = null, r = 0, c = !0, i = [], p = {
|
|
1544
|
-
ownerId: null,
|
|
1545
|
-
groups: i
|
|
1546
|
-
};
|
|
1547
|
-
const u = () => {
|
|
1548
|
-
for (const x of t)
|
|
1549
|
-
x();
|
|
1550
|
-
}, z = () => {
|
|
1551
|
-
c = !0, u();
|
|
1552
|
-
}, s = () => {
|
|
1553
|
-
const x = d;
|
|
1554
|
-
if (x && n.has(x))
|
|
1555
|
-
return !1;
|
|
1556
|
-
d = null;
|
|
1557
|
-
const C = n.values().next();
|
|
1558
|
-
return C.done || (d = C.value), x !== d;
|
|
1559
|
-
};
|
|
1560
|
-
return {
|
|
1561
|
-
subscribe: (x) => (t.add(x), () => {
|
|
1562
|
-
t.delete(x);
|
|
1563
|
-
}),
|
|
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 = {
|
|
1565
|
-
ownerId: d,
|
|
1566
|
-
groups: i
|
|
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();
|
|
1572
|
-
},
|
|
1573
|
-
disableGroup: (x) => {
|
|
1574
|
-
n.delete(x) && s() && z();
|
|
1575
|
-
},
|
|
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;
|
|
1582
|
-
else
|
|
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;
|
|
1587
|
-
break;
|
|
1588
|
-
}
|
|
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;
|
|
1591
|
-
break;
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
1594
|
-
let oe = S?.serializedHandles !== re;
|
|
1595
|
-
if (!oe && S)
|
|
1596
|
-
if (S.handles.length !== C.handles.length)
|
|
1597
|
-
oe = !0;
|
|
1598
|
-
else
|
|
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;
|
|
1603
|
-
break;
|
|
1604
|
-
}
|
|
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;
|
|
1607
|
-
break;
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
if (!S && C.panels.length === 0 && C.handles.length === 0 || S && !de && !j && !_ && !E && !oe)
|
|
1611
|
-
return;
|
|
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,
|
|
1620
|
-
index: D,
|
|
1621
|
-
serializedPanels: X,
|
|
1622
|
-
serializedHandles: re
|
|
1623
|
-
}), z();
|
|
1624
|
-
},
|
|
1625
|
-
removeGroup: (x) => {
|
|
1626
|
-
const C = e.delete(x), S = n.delete(x), D = s();
|
|
1627
|
-
(C || S || D) && z();
|
|
1628
|
-
}
|
|
1629
|
-
};
|
|
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);
|
|
1634
|
-
}, Yt = (t, e) => {
|
|
1635
|
-
Fe.updateGroup(t, e);
|
|
1636
|
-
}, dt = (t) => {
|
|
1637
|
-
Fe.removeGroup(t);
|
|
1638
|
-
};
|
|
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 = {
|
|
1641
|
-
position: "fixed",
|
|
1642
|
-
left: "50%",
|
|
1643
|
-
bottom: "20px",
|
|
1644
|
-
transform: "translate(-50%, 0)",
|
|
1645
|
-
zIndex: 100,
|
|
1646
|
-
maxWidth: "min(90vw, 1120px)",
|
|
1647
|
-
width: "100%",
|
|
1648
|
-
borderRadius: "14px",
|
|
1649
|
-
backgroundColor: "rgba(15, 23, 42, 0.72)",
|
|
1650
|
-
color: "#e2e8f0",
|
|
1651
|
-
fontFamily: "monospace",
|
|
1652
|
-
fontSize: "11px",
|
|
1653
|
-
lineHeight: 1.6,
|
|
1654
|
-
boxShadow: "0 22px 45px rgba(15,23,42,0.45)",
|
|
1655
|
-
border: "1px solid rgba(148, 163, 184, 0.22)",
|
|
1656
|
-
backdropFilter: "blur(10px)",
|
|
1657
|
-
WebkitBackdropFilter: "blur(10px)",
|
|
1658
|
-
pointerEvents: "auto",
|
|
1659
|
-
overflow: "auto"
|
|
1660
|
-
}, qt = {
|
|
1661
|
-
display: "flex",
|
|
1662
|
-
justifyContent: "space-between",
|
|
1663
|
-
alignItems: "center",
|
|
1664
|
-
flexWrap: "wrap",
|
|
1665
|
-
gap: "12px"
|
|
1666
|
-
}, Jt = {
|
|
1667
|
-
display: "flex",
|
|
1668
|
-
flexDirection: "column",
|
|
1669
|
-
gap: "4px"
|
|
1670
|
-
}, Kt = {
|
|
1671
|
-
padding: "6px 10px",
|
|
1672
|
-
borderRadius: "9999px",
|
|
1673
|
-
border: "1px solid rgba(148, 163, 184, 0.35)",
|
|
1674
|
-
color: "#e2e8f0",
|
|
1675
|
-
fontWeight: 600,
|
|
1676
|
-
fontSize: "10px",
|
|
1677
|
-
letterSpacing: "0.03em",
|
|
1678
|
-
textTransform: "uppercase",
|
|
1679
|
-
cursor: "pointer",
|
|
1680
|
-
transition: "background-color 0.18s ease, border-color 0.18s ease"
|
|
1681
|
-
}, Qt = {
|
|
1682
|
-
padding: "10px 12px",
|
|
1683
|
-
borderRadius: "10px",
|
|
1684
|
-
backgroundColor: "rgba(30, 41, 59, 0.55)",
|
|
1685
|
-
border: "1px solid rgba(148, 163, 184, 0.18)",
|
|
1686
|
-
display: "flex",
|
|
1687
|
-
flexDirection: "column",
|
|
1688
|
-
gap: "10px"
|
|
1689
|
-
}, ei = {
|
|
1690
|
-
padding: "8px 10px",
|
|
1691
|
-
borderRadius: "8px",
|
|
1692
|
-
backgroundColor: "rgba(15, 23, 42, 0.55)",
|
|
1693
|
-
border: "1px solid rgba(148, 163, 184, 0.16)",
|
|
1694
|
-
display: "flex",
|
|
1695
|
-
flexDirection: "column",
|
|
1696
|
-
gap: "4px"
|
|
1697
|
-
}, ft = {
|
|
1698
|
-
display: "flex",
|
|
1699
|
-
justifyContent: "space-between",
|
|
1700
|
-
alignItems: "center",
|
|
1701
|
-
gap: "6px"
|
|
1702
|
-
}, ti = {
|
|
1703
|
-
display: "grid",
|
|
1704
|
-
gridTemplateColumns: "auto 1fr",
|
|
1705
|
-
gap: "2px 10px",
|
|
1706
|
-
color: "#e2e8f0"
|
|
1707
|
-
}, ii = {
|
|
1708
|
-
padding: "2px 6px",
|
|
1709
|
-
borderRadius: "9999px",
|
|
1710
|
-
fontSize: "10px",
|
|
1711
|
-
textTransform: "uppercase"
|
|
1712
|
-
}, ri = (t) => {
|
|
1713
|
-
const e = t.reason === "minimum-exceeded", n = e ? "Layout unavailable: minimum panel sizes exceed the container." : "Layout unavailable: panels cannot fill the container with their maximum sizes.", d = e ? `Min required: ${Math.ceil(t.totalMinimumSize ?? 0)}px | Available: ${Math.floor(t.availableContainerSize)}px` : `Max total: ${Math.floor(t.totalMaximumSize ?? 0)}px | Needed: ${Math.floor(t.availableContainerSize)}px`;
|
|
1714
|
-
return { summary: n, detail: d };
|
|
1715
|
-
}, ni = (t, e) => {
|
|
1716
|
-
let n = !1;
|
|
1717
|
-
const d = t.map((r) => {
|
|
1718
|
-
const c = e[r.id];
|
|
1719
|
-
return !c || r.measuredPixelSize === c.pixelSize && r.measuredPercentageSize === c.percentageSize ? r : (n = !0, {
|
|
1720
|
-
...r,
|
|
1721
|
-
measuredPixelSize: c.pixelSize,
|
|
1722
|
-
measuredPercentageSize: c.percentageSize
|
|
1723
|
-
});
|
|
1724
|
-
});
|
|
1725
|
-
return n ? d : t;
|
|
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 };
|
|
1729
|
-
}, fi = (t) => {
|
|
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(() => {
|
|
1731
|
-
if (!a)
|
|
1732
|
-
return null;
|
|
1733
|
-
const { summary: U, detail: V } = ri(a);
|
|
1734
|
-
return /* @__PURE__ */ fe(
|
|
1735
|
-
"div",
|
|
1736
|
-
{
|
|
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",
|
|
1738
|
-
"data-panel-group-placeholder": "constraint-violation",
|
|
1739
|
-
children: [
|
|
1740
|
-
/* @__PURE__ */ I("span", { children: U }),
|
|
1741
|
-
/* @__PURE__ */ I("span", { className: "text-slate-500 text-xs dark:text-slate-400", children: V })
|
|
1742
|
-
]
|
|
1743
|
-
}
|
|
1744
|
-
);
|
|
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)
|
|
1747
|
-
return [];
|
|
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) {
|
|
1753
|
-
s({ width: 0, height: 0 });
|
|
1754
|
-
return;
|
|
1755
|
-
}
|
|
1756
|
-
if (typeof window > "u" || typeof ResizeObserver > "u")
|
|
1757
|
-
return;
|
|
1758
|
-
const U = i.current;
|
|
1759
|
-
if (!U)
|
|
1760
|
-
return;
|
|
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)
|
|
1766
|
-
continue;
|
|
1767
|
-
const N = pt(U, y.contentRect.width, y.contentRect.height);
|
|
1768
|
-
V(N);
|
|
1769
|
-
}
|
|
1770
|
-
});
|
|
1771
|
-
return O.observe(U), V(pt(U)), () => {
|
|
1772
|
-
O.disconnect();
|
|
1773
|
-
};
|
|
1774
|
-
}, [i, x]);
|
|
1775
|
-
const E = ae(() => ni(C, S), [C, S]);
|
|
1776
|
-
se(() => {
|
|
1777
|
-
if (!x) {
|
|
1778
|
-
ct(m), dt(m);
|
|
1779
|
-
return;
|
|
1780
|
-
}
|
|
1781
|
-
return Vt(m), () => {
|
|
1782
|
-
ct(m), dt(m);
|
|
1783
|
-
};
|
|
1784
|
-
}, [x, m]), se(() => {
|
|
1785
|
-
x && Yt(m, {
|
|
1786
|
-
displayName: v,
|
|
1787
|
-
direction: c,
|
|
1788
|
-
containerSize: {
|
|
1789
|
-
width: re,
|
|
1790
|
-
height: de
|
|
1791
|
-
},
|
|
1792
|
-
panels: E,
|
|
1793
|
-
handles: D
|
|
1794
|
-
});
|
|
1795
|
-
}, [x, m, v, c, re, de, E, D]);
|
|
1796
|
-
const oe = ae(() => {
|
|
1797
|
-
const U = {
|
|
1798
|
-
...u,
|
|
1799
|
-
...d
|
|
1800
|
-
};
|
|
1801
|
-
return U.position || (U.position = "relative"), U;
|
|
1802
|
-
}, [u, d]);
|
|
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: [
|
|
1805
|
-
r,
|
|
1806
|
-
o && h ? /* @__PURE__ */ I(
|
|
1807
|
-
"div",
|
|
1808
|
-
{
|
|
1809
|
-
className: "pointer-events-auto",
|
|
1810
|
-
style: {
|
|
1811
|
-
position: "absolute",
|
|
1812
|
-
inset: 0,
|
|
1813
|
-
zIndex: 40,
|
|
1814
|
-
display: "flex",
|
|
1815
|
-
flexDirection: "column",
|
|
1816
|
-
alignItems: "center",
|
|
1817
|
-
justifyContent: "center",
|
|
1818
|
-
backgroundColor: "rgba(248, 250, 252, 0.82)",
|
|
1819
|
-
backdropFilter: "blur(2px)"
|
|
1820
|
-
},
|
|
1821
|
-
children: h
|
|
1822
|
-
}
|
|
1823
|
-
) : null
|
|
1824
|
-
] }),
|
|
1825
|
-
_ && /* @__PURE__ */ I(oi, {})
|
|
1826
|
-
] });
|
|
1827
|
-
}, oi = () => {
|
|
1828
|
-
const e = jt().groups, [n, d] = Me(!0);
|
|
1829
|
-
if (e.length === 0 || typeof document > "u")
|
|
1830
|
-
return null;
|
|
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(
|
|
1832
|
-
"div",
|
|
1833
|
-
{
|
|
1834
|
-
style: {
|
|
1835
|
-
...Xt,
|
|
1836
|
-
padding: n ? "10px 18px" : "14px 18px",
|
|
1837
|
-
maxHeight: n ? "52px" : "min(65vh, 520px)",
|
|
1838
|
-
transition: "max-height 0.24s ease, padding 0.24s ease"
|
|
1839
|
-
},
|
|
1840
|
-
children: [
|
|
1841
|
-
/* @__PURE__ */ fe(
|
|
1842
|
-
"div",
|
|
1843
|
-
{
|
|
1844
|
-
style: {
|
|
1845
|
-
...qt,
|
|
1846
|
-
marginBottom: n ? 0 : "12px"
|
|
1847
|
-
},
|
|
1848
|
-
children: [
|
|
1849
|
-
/* @__PURE__ */ fe("div", { style: Jt, children: [
|
|
1850
|
-
/* @__PURE__ */ I(
|
|
1851
|
-
"span",
|
|
1852
|
-
{
|
|
1853
|
-
style: {
|
|
1854
|
-
fontWeight: 700,
|
|
1855
|
-
fontSize: "12px",
|
|
1856
|
-
letterSpacing: "0.03em"
|
|
1857
|
-
},
|
|
1858
|
-
children: "Panel Overview"
|
|
1859
|
-
}
|
|
1860
|
-
),
|
|
1861
|
-
/* @__PURE__ */ fe("span", { style: { color: "#cbd5f5" }, children: [
|
|
1862
|
-
"groups: ",
|
|
1863
|
-
e.length,
|
|
1864
|
-
" / panels: ",
|
|
1865
|
-
r,
|
|
1866
|
-
" / resizers: ",
|
|
1867
|
-
c
|
|
1868
|
-
] })
|
|
1869
|
-
] }),
|
|
1870
|
-
/* @__PURE__ */ I(
|
|
1871
|
-
"button",
|
|
1872
|
-
{
|
|
1873
|
-
type: "button",
|
|
1874
|
-
onClick: i,
|
|
1875
|
-
style: {
|
|
1876
|
-
...Kt,
|
|
1877
|
-
backgroundColor: n ? "rgba(59, 130, 246, 0.2)" : "rgba(71, 85, 105, 0.45)"
|
|
1878
|
-
},
|
|
1879
|
-
title: n ? "Panel Overview を開く" : "Panel Overview を閉じる",
|
|
1880
|
-
children: n ? "開く" : "閉じる"
|
|
1881
|
-
}
|
|
1882
|
-
)
|
|
1883
|
-
]
|
|
1884
|
-
}
|
|
1885
|
-
),
|
|
1886
|
-
!n && /* @__PURE__ */ I(
|
|
1887
|
-
"div",
|
|
1888
|
-
{
|
|
1889
|
-
style: {
|
|
1890
|
-
display: "flex",
|
|
1891
|
-
flexDirection: "column",
|
|
1892
|
-
gap: "12px",
|
|
1893
|
-
maxHeight: "45vh",
|
|
1894
|
-
overflowY: "auto",
|
|
1895
|
-
paddingRight: "6px"
|
|
1896
|
-
},
|
|
1897
|
-
children: e.map((u, z) => {
|
|
1898
|
-
const s = u.direction === "horizontal" ? u.containerSize.width : u.containerSize.height;
|
|
1899
|
-
return /* @__PURE__ */ fe("div", { style: Qt, children: [
|
|
1900
|
-
/* @__PURE__ */ fe(
|
|
1901
|
-
"div",
|
|
1902
|
-
{
|
|
1903
|
-
style: {
|
|
1904
|
-
...ft,
|
|
1905
|
-
flexWrap: "wrap",
|
|
1906
|
-
gap: "10px",
|
|
1907
|
-
color: "#dbeafe"
|
|
1908
|
-
},
|
|
1909
|
-
children: [
|
|
1910
|
-
/* @__PURE__ */ fe(
|
|
1911
|
-
"span",
|
|
1912
|
-
{
|
|
1913
|
-
style: {
|
|
1914
|
-
fontWeight: 600,
|
|
1915
|
-
fontSize: "11px",
|
|
1916
|
-
letterSpacing: "0.02em",
|
|
1917
|
-
textTransform: "uppercase"
|
|
1918
|
-
},
|
|
1919
|
-
children: [
|
|
1920
|
-
"group ",
|
|
1921
|
-
z + 1,
|
|
1922
|
-
": ",
|
|
1923
|
-
u.displayName
|
|
1924
|
-
]
|
|
1925
|
-
}
|
|
1926
|
-
),
|
|
1927
|
-
/* @__PURE__ */ fe("span", { children: [
|
|
1928
|
-
"direction: ",
|
|
1929
|
-
u.direction,
|
|
1930
|
-
" / container: ",
|
|
1931
|
-
_e(u.containerSize.width, "px"),
|
|
1932
|
-
" × ",
|
|
1933
|
-
_e(u.containerSize.height, "px")
|
|
1934
|
-
] })
|
|
1935
|
-
]
|
|
1936
|
-
}
|
|
1937
|
-
),
|
|
1938
|
-
/* @__PURE__ */ I(
|
|
1939
|
-
"div",
|
|
1940
|
-
{
|
|
1941
|
-
style: {
|
|
1942
|
-
display: "grid",
|
|
1943
|
-
gridTemplateColumns: "repeat(auto-fill, minmax(220px, 1fr))",
|
|
1944
|
-
gap: "10px"
|
|
1945
|
-
},
|
|
1946
|
-
children: u.panels.map((a, o) => {
|
|
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(
|
|
1952
|
-
"span",
|
|
1953
|
-
{
|
|
1954
|
-
style: {
|
|
1955
|
-
...ii,
|
|
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"
|
|
1958
|
-
},
|
|
1959
|
-
children: S
|
|
1960
|
-
}
|
|
1961
|
-
)
|
|
1962
|
-
] }),
|
|
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 ?? "—" })
|
|
1984
|
-
] })
|
|
1985
|
-
] }, a.id || o);
|
|
1986
|
-
})
|
|
1987
|
-
}
|
|
1988
|
-
)
|
|
1989
|
-
] }, u.groupId);
|
|
1990
|
-
})
|
|
1991
|
-
}
|
|
1992
|
-
)
|
|
1993
|
-
]
|
|
1994
|
-
}
|
|
1995
|
-
);
|
|
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;
|
|
2011
|
-
break;
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
for (let A = g + 1; A < $.length; A += 1) {
|
|
2015
|
-
const B = $[A];
|
|
2016
|
-
if (B.dataset.panelId) {
|
|
2017
|
-
M = B;
|
|
2018
|
-
break;
|
|
2019
|
-
}
|
|
2020
|
-
}
|
|
2021
|
-
S.current = w?.dataset.panelId || "", D.current = M?.dataset.panelId || "", re({
|
|
2022
|
-
left: S.current || null,
|
|
2023
|
-
right: D.current || null
|
|
2024
|
-
});
|
|
2025
|
-
}
|
|
2026
|
-
}
|
|
2027
|
-
}
|
|
2028
|
-
}, []), se(() => {
|
|
2029
|
-
if (E === j.current)
|
|
2030
|
-
return;
|
|
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;
|
|
2035
|
-
return () => {
|
|
2036
|
-
o(P, null);
|
|
2037
|
-
};
|
|
2038
|
-
}, [o]);
|
|
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)
|
|
2057
|
-
return;
|
|
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)) {
|
|
2062
|
-
z(D.current, "start");
|
|
2063
|
-
return;
|
|
2064
|
-
}
|
|
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");
|
|
2068
|
-
return;
|
|
2069
|
-
}
|
|
2070
|
-
if (q.collapsed && K > Math.max(L * 0.3, Ne)) {
|
|
2071
|
-
s(D.current, Ae, K);
|
|
2072
|
-
return;
|
|
2073
|
-
}
|
|
2074
|
-
if (W.collapsed && ne > Math.max(f * 0.3, Ne)) {
|
|
2075
|
-
s(S.current, Te, ne);
|
|
2076
|
-
return;
|
|
2077
|
-
}
|
|
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);
|
|
2087
|
-
}
|
|
2088
|
-
if (Je)
|
|
2089
|
-
return;
|
|
2090
|
-
}
|
|
2091
|
-
if (W.collapsed || q.collapsed)
|
|
2092
|
-
return;
|
|
2093
|
-
p(S.current, D.current, ne, K);
|
|
2094
|
-
}
|
|
2095
|
-
}, R = () => {
|
|
2096
|
-
v(!1), c?.(!1), document.removeEventListener("pointermove", T), document.removeEventListener("pointerup", R);
|
|
2097
|
-
};
|
|
2098
|
-
document.addEventListener("pointermove", T), document.addEventListener("pointerup", R);
|
|
2099
|
-
},
|
|
2100
|
-
[U, i, p, u, z, s, c]
|
|
2101
|
-
), O = i === "horizontal", y = $e(
|
|
2102
|
-
"group absolute z-20 flex select-none items-center justify-center border-none bg-transparent transition-colors duration-150 overflow-visible",
|
|
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",
|
|
2109
|
-
"focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50",
|
|
2110
|
-
n
|
|
2111
|
-
), N = ae(() => {
|
|
2112
|
-
const P = ($) => {
|
|
2113
|
-
if (!$)
|
|
2114
|
-
return -1;
|
|
2115
|
-
for (let l = 0; l < a.length; l += 1)
|
|
2116
|
-
if (a[l].id === $)
|
|
2117
|
-
return l;
|
|
2118
|
-
return -1;
|
|
2119
|
-
};
|
|
2120
|
-
return {
|
|
2121
|
-
left: P(X.left),
|
|
2122
|
-
right: P(X.right)
|
|
2123
|
-
};
|
|
2124
|
-
}, [X.left, X.right, a]), be = O ? h.width : h.height, ce = ae(() => {
|
|
2125
|
-
const P = ($, l) => {
|
|
2126
|
-
if ($ > l)
|
|
2127
|
-
return 0;
|
|
2128
|
-
let g = 0;
|
|
2129
|
-
for (let w = $; w <= l; w += 1) {
|
|
2130
|
-
const M = a[w];
|
|
2131
|
-
if (!M)
|
|
2132
|
-
continue;
|
|
2133
|
-
const A = M.size ?? 0, B = Math.max(0, A);
|
|
2134
|
-
g += M.collapsed ? 0 : B;
|
|
2135
|
-
}
|
|
2136
|
-
return g;
|
|
2137
|
-
};
|
|
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 = {
|
|
2141
|
-
position: "absolute",
|
|
2142
|
-
zIndex: 20,
|
|
2143
|
-
touchAction: "none"
|
|
2144
|
-
};
|
|
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)
|
|
2149
|
-
return !1;
|
|
2150
|
-
const T = a[Z];
|
|
2151
|
-
return T ? T.collapsed ? !0 : T.size <= P : !1;
|
|
2152
|
-
}, l = (Z, T) => {
|
|
2153
|
-
if (!$(Z))
|
|
2154
|
-
return 0;
|
|
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;
|
|
2160
|
-
return {
|
|
2161
|
-
groupSize: M + A + 1,
|
|
2162
|
-
overlapIndex: M
|
|
2163
|
-
};
|
|
2164
|
-
}, [N.left, N.right, a, be]), pe = ae(() => {
|
|
2165
|
-
if (oe)
|
|
2166
|
-
return !0;
|
|
2167
|
-
if (ue.groupSize <= 1)
|
|
2168
|
-
return !1;
|
|
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)
|
|
2173
|
-
return 0;
|
|
2174
|
-
const P = ue.groupSize > 1 ? 2 : 1;
|
|
2175
|
-
if (P === 1)
|
|
2176
|
-
return 0;
|
|
2177
|
-
const $ = ue.overlapIndex === 0 ? 0 : P - 1, l = (P - 1) / 2;
|
|
2178
|
-
return ($ - l) * Bt;
|
|
2179
|
-
}, [ue, pe]), ye = ae(() => {
|
|
2180
|
-
if (pe)
|
|
2181
|
-
return { display: "none" };
|
|
2182
|
-
if (ge !== 0)
|
|
2183
|
-
return O ? { transform: `translateX(${ge}px)` } : { transform: `translateY(${ge}px)` };
|
|
2184
|
-
}, [ge, O, pe]), Be = $e(
|
|
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)]",
|
|
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)]",
|
|
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(
|
|
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)]",
|
|
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)
|
|
2197
|
-
return;
|
|
2198
|
-
let $ = 0;
|
|
2199
|
-
if (!pe) {
|
|
2200
|
-
const w = i === "horizontal" ? P.offsetWidth : P.offsetHeight;
|
|
2201
|
-
let M = 0, A = 0;
|
|
2202
|
-
if (typeof window < "u") {
|
|
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"));
|
|
2205
|
-
}
|
|
2206
|
-
$ = [w, M, A].reduce((H, Z) => Number.isFinite(Z) ? H + Z : H, 0);
|
|
2207
|
-
}
|
|
2208
|
-
(!Number.isFinite($) || $ < 0) && ($ = 0);
|
|
2209
|
-
const l = {
|
|
2210
|
-
id: E,
|
|
2211
|
-
thickness: $,
|
|
2212
|
-
direction: i,
|
|
2213
|
-
visible: !pe && $ > Nt,
|
|
2214
|
-
startPanelId: X.left,
|
|
2215
|
-
endPanelId: X.right
|
|
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)
|
|
2224
|
-
return;
|
|
2225
|
-
if (typeof ResizeObserver > "u") {
|
|
2226
|
-
G();
|
|
2227
|
-
return;
|
|
2228
|
-
}
|
|
2229
|
-
const $ = new ResizeObserver(() => {
|
|
2230
|
-
G();
|
|
2231
|
-
});
|
|
2232
|
-
return $.observe(P), () => {
|
|
2233
|
-
$.disconnect();
|
|
2234
|
-
};
|
|
2235
|
-
}, [G]);
|
|
2236
|
-
const le = ae(() => {
|
|
2237
|
-
const P = d ? { ...he, ...d } : he;
|
|
2238
|
-
return pe ? {
|
|
2239
|
-
...P,
|
|
2240
|
-
display: "none",
|
|
2241
|
-
pointerEvents: "none",
|
|
2242
|
-
visibility: "hidden"
|
|
2243
|
-
} : P;
|
|
2244
|
-
}, [he, pe, d]);
|
|
2245
|
-
return /* @__PURE__ */ I(
|
|
2246
|
-
"button",
|
|
2247
|
-
{
|
|
2248
|
-
type: "button",
|
|
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 }) })
|
|
2259
|
-
}
|
|
2260
|
-
);
|
|
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}"]`);
|
|
1
|
+
import { a as s, b as n, c as l, d as t, e as o, g as i, f as r, h as u, i as P, j as g, l as m, n as p, s as z, u as C, k as d, m as G } from "./index-BzgId8aQ.js";
|
|
2262
2
|
export {
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
3
|
+
s as Panel,
|
|
4
|
+
n as PanelGroup,
|
|
5
|
+
l as PanelGroupContext,
|
|
6
|
+
t as PanelResizeHandle,
|
|
7
|
+
o as clamp,
|
|
8
|
+
i as getConstraintInPixels,
|
|
9
|
+
r as getContainerSize,
|
|
10
|
+
u as getPanelElement,
|
|
11
|
+
P as getPanelGroupElement,
|
|
12
|
+
g as getResizeHandleElement,
|
|
13
|
+
m as loadLayout,
|
|
14
|
+
p as normalizeSizeConfig,
|
|
15
|
+
z as saveLayout,
|
|
16
|
+
C as usePanelControls,
|
|
17
|
+
d as usePanelGroup,
|
|
18
|
+
G as useResizablePanels
|
|
2279
19
|
};
|