@dynamix-layout/core 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/core.cjs +2 -2
- package/dist/core.es.js +408 -289
- package/dist/core.iife.js +2 -2
- package/dist/core.umd.js +2 -2
- package/dist/types/index.d.cts +50 -0
- package/dist/types/index.d.ts +50 -0
- package/package.json +1 -1
package/dist/core.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class g {
|
|
2
2
|
buffer;
|
|
3
3
|
head = 0;
|
|
4
4
|
tail = 0;
|
|
@@ -50,14 +50,14 @@ class b {
|
|
|
50
50
|
return !0;
|
|
51
51
|
const n = e.size();
|
|
52
52
|
if (t === 0) {
|
|
53
|
-
const
|
|
54
|
-
for (let
|
|
55
|
-
this.enqueueFront(
|
|
53
|
+
const h = e.toArray();
|
|
54
|
+
for (let u = h.length - 1; u >= 0; u--)
|
|
55
|
+
this.enqueueFront(h[u]);
|
|
56
56
|
return !0;
|
|
57
57
|
}
|
|
58
58
|
if (t === this.count) {
|
|
59
|
-
for (const
|
|
60
|
-
this.enqueue(
|
|
59
|
+
for (const h of e)
|
|
60
|
+
this.enqueue(h);
|
|
61
61
|
return !0;
|
|
62
62
|
}
|
|
63
63
|
for (; this.count + n > this.capacity; )
|
|
@@ -286,34 +286,34 @@ class b {
|
|
|
286
286
|
this.tail = (this.tail + n) % this.capacity;
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function T(o, t = (e, n) => e === n) {
|
|
290
290
|
let e = o;
|
|
291
291
|
const n = /* @__PURE__ */ new Set();
|
|
292
292
|
let i = [];
|
|
293
|
-
const s = () => e, r = (
|
|
293
|
+
const s = () => e, r = (l, m = !1) => {
|
|
294
294
|
if (m) {
|
|
295
|
-
e =
|
|
295
|
+
e = l;
|
|
296
296
|
return;
|
|
297
297
|
}
|
|
298
|
-
t(e,
|
|
299
|
-
},
|
|
300
|
-
n.forEach((
|
|
301
|
-
},
|
|
302
|
-
i.push(
|
|
298
|
+
t(e, l) || (e = l, n.forEach((p) => p(e)), i.forEach((p) => p(e)), i = []);
|
|
299
|
+
}, h = () => {
|
|
300
|
+
n.forEach((l) => l(e)), i.forEach((l) => l(e)), i = [];
|
|
301
|
+
}, u = (l) => (n.add(l), () => n.delete(l)), f = () => new Promise((l) => {
|
|
302
|
+
i.push(l);
|
|
303
303
|
});
|
|
304
304
|
return {
|
|
305
305
|
get: s,
|
|
306
306
|
set: r,
|
|
307
|
-
onChange:
|
|
308
|
-
nextChange:
|
|
309
|
-
triggerChange:
|
|
310
|
-
onChangePromise: (
|
|
307
|
+
onChange: u,
|
|
308
|
+
nextChange: f,
|
|
309
|
+
triggerChange: h,
|
|
310
|
+
onChangePromise: (l) => {
|
|
311
311
|
let m = !0;
|
|
312
312
|
return (async () => {
|
|
313
313
|
for (; m; ) {
|
|
314
|
-
const I = await
|
|
314
|
+
const I = await f();
|
|
315
315
|
if (!m) break;
|
|
316
|
-
|
|
316
|
+
l(I);
|
|
317
317
|
}
|
|
318
318
|
})(), () => {
|
|
319
319
|
m = !1;
|
|
@@ -325,28 +325,31 @@ function E(o, t) {
|
|
|
325
325
|
if (o.size !== t.size) return !1;
|
|
326
326
|
for (const [e, n] of o.entries()) {
|
|
327
327
|
const i = t.get(e);
|
|
328
|
-
if (!i || !
|
|
328
|
+
if (!i || !C(n, i))
|
|
329
329
|
return !1;
|
|
330
330
|
}
|
|
331
331
|
return !0;
|
|
332
332
|
}
|
|
333
|
-
function
|
|
334
|
-
if (o.typNode !== t.typNode || o.nodName !== t.nodName || o.uidNode !== t.uidNode || o.nodPart !== t.nodPart) return !1;
|
|
333
|
+
function C(o, t) {
|
|
334
|
+
if (o.typNode !== t.typNode || o.nodName !== t.nodName || o.uidNode !== t.uidNode || o.nodPart !== t.nodPart || o.nodFold !== t.nodFold || o.nodMaxd !== t.nodMaxd || o.nodHidden !== t.nodHidden || o.nodLocked !== t.nodLocked) return !1;
|
|
335
335
|
const e = o.nodDims, n = t.nodDims;
|
|
336
336
|
return e.x === n.x && e.y === n.y && e.w === n.w && e.h === n.h;
|
|
337
337
|
}
|
|
338
|
-
const
|
|
338
|
+
const D = () => crypto.randomUUID(), O = {
|
|
339
339
|
set: (o, t) => setTimeout(o, t),
|
|
340
340
|
clear: (o) => clearTimeout(o)
|
|
341
|
-
},
|
|
342
|
-
createId:
|
|
343
|
-
timer:
|
|
341
|
+
}, c = {
|
|
342
|
+
createId: D,
|
|
343
|
+
timer: O,
|
|
344
344
|
root: void 0,
|
|
345
345
|
tree: null,
|
|
346
346
|
minW: 40,
|
|
347
347
|
minH: 40,
|
|
348
348
|
bond: 10,
|
|
349
|
-
inst: null
|
|
349
|
+
inst: null,
|
|
350
|
+
maximized: null,
|
|
351
|
+
collapsedSize: 40,
|
|
352
|
+
foldSeq: 0
|
|
350
353
|
};
|
|
351
354
|
class a {
|
|
352
355
|
static cache = {
|
|
@@ -354,20 +357,20 @@ class a {
|
|
|
354
357
|
mapDirs: /* @__PURE__ */ new Map(),
|
|
355
358
|
tabCnts: /* @__PURE__ */ new Map(),
|
|
356
359
|
mapElem: /* @__PURE__ */ new Map(),
|
|
357
|
-
tabOpts:
|
|
360
|
+
tabOpts: T(
|
|
358
361
|
/* @__PURE__ */ new Map(),
|
|
359
362
|
E
|
|
360
363
|
),
|
|
361
|
-
nodOpts:
|
|
364
|
+
nodOpts: T(
|
|
362
365
|
/* @__PURE__ */ new Map(),
|
|
363
366
|
E
|
|
364
367
|
),
|
|
365
|
-
bndOpts:
|
|
368
|
+
bndOpts: T(
|
|
366
369
|
/* @__PURE__ */ new Map(),
|
|
367
370
|
E
|
|
368
371
|
)
|
|
369
372
|
};
|
|
370
|
-
kids = new
|
|
373
|
+
kids = new g();
|
|
371
374
|
dims = { w: 0, h: 0, x: 0, y: 0 };
|
|
372
375
|
unId;
|
|
373
376
|
next = null;
|
|
@@ -377,6 +380,8 @@ class a {
|
|
|
377
380
|
part = 0;
|
|
378
381
|
host = null;
|
|
379
382
|
open = "";
|
|
383
|
+
collapsed = !1;
|
|
384
|
+
foldedAt = 0;
|
|
380
385
|
constructor(t = {}) {
|
|
381
386
|
const e = {
|
|
382
387
|
type: "row",
|
|
@@ -384,23 +389,23 @@ class a {
|
|
|
384
389
|
name: "",
|
|
385
390
|
part: 100,
|
|
386
391
|
dims: { w: 0, h: 0, x: 0, y: 0 },
|
|
387
|
-
unId:
|
|
392
|
+
unId: c.createId(),
|
|
388
393
|
open: ""
|
|
389
394
|
};
|
|
390
395
|
this.type = t.type ?? e.type, this.host = t.host ?? e.host, this.name = t.name ?? e.name, this.part = t.part ?? e.part, this.dims = t.dims ?? e.dims, this.open = t.open ?? e.open, this.unId = t.unId || e.unId;
|
|
391
396
|
}
|
|
392
397
|
addBond(t, e = null) {
|
|
393
398
|
if (!e) return;
|
|
394
|
-
const n = new
|
|
399
|
+
const n = new A(t, this, e);
|
|
395
400
|
a.cache.mapElem.set(n.unId, n);
|
|
396
401
|
}
|
|
397
402
|
getReqDimension() {
|
|
398
403
|
const t = a.cache.dimMins.get(this.unId), e = a.cache.tabCnts.get(this.unId), n = Math.max(
|
|
399
404
|
t.minWidth,
|
|
400
|
-
e.horizontal *
|
|
405
|
+
e.horizontal * c.minW + Math.max(0, e.horizontal - 1) * c.bond
|
|
401
406
|
), i = Math.max(
|
|
402
407
|
t.minHeight,
|
|
403
|
-
e.vertical *
|
|
408
|
+
e.vertical * c.minH + Math.max(0, e.vertical - 1) * c.bond
|
|
404
409
|
);
|
|
405
410
|
return {
|
|
406
411
|
width: n,
|
|
@@ -415,35 +420,35 @@ class a {
|
|
|
415
420
|
minWidth: 0,
|
|
416
421
|
minHeight: 0
|
|
417
422
|
};
|
|
418
|
-
let i = 0;
|
|
419
|
-
for (const
|
|
420
|
-
e +=
|
|
423
|
+
let i = 0, s;
|
|
424
|
+
for (const d of this.kids)
|
|
425
|
+
d.collapsed || (e += d.part, s = d);
|
|
421
426
|
if (e === 0) return;
|
|
422
|
-
let
|
|
423
|
-
t ?
|
|
424
|
-
const
|
|
425
|
-
let
|
|
426
|
-
for (const
|
|
427
|
-
const
|
|
427
|
+
let r;
|
|
428
|
+
t ? r = this.dims.w - n.minWidth : r = this.dims.h - n.minHeight;
|
|
429
|
+
const h = r < 0;
|
|
430
|
+
let u = 0, f = 0;
|
|
431
|
+
for (const d of this.kids) {
|
|
432
|
+
const l = a.cache.dimMins.get(d.unId) || {
|
|
428
433
|
minWidth: 0,
|
|
429
434
|
minHeight: 0
|
|
430
435
|
};
|
|
431
436
|
let m = 0;
|
|
432
|
-
if (!
|
|
433
|
-
|
|
434
|
-
const p =
|
|
435
|
-
m = p -
|
|
437
|
+
if (!h && !d.collapsed) {
|
|
438
|
+
u += d.part;
|
|
439
|
+
const p = d === s ? r : Math.round(r * u / e);
|
|
440
|
+
m = p - f, f = p;
|
|
436
441
|
}
|
|
437
|
-
t ? (
|
|
438
|
-
w:
|
|
439
|
-
h:
|
|
440
|
-
x:
|
|
441
|
-
y:
|
|
442
|
-
} :
|
|
443
|
-
w:
|
|
444
|
-
h:
|
|
445
|
-
x:
|
|
446
|
-
y:
|
|
442
|
+
t ? (d.dims.w = l.minWidth + m, d.dims.h = this.dims.h, d.dims.x = this.dims.x + i, d.dims.y = this.dims.y, i += d.dims.w + c.bond) : (d.dims.h = l.minHeight + m, d.dims.w = this.dims.w, d.dims.y = this.dims.y + i, d.dims.x = this.dims.x, i += d.dims.h + c.bond), d.next && (t ? d.next.dims = {
|
|
443
|
+
w: c.bond,
|
|
444
|
+
h: d.dims.h,
|
|
445
|
+
x: d.dims.x + d.dims.w,
|
|
446
|
+
y: d.dims.y
|
|
447
|
+
} : d.next.dims = {
|
|
448
|
+
w: d.dims.w,
|
|
449
|
+
h: c.bond,
|
|
450
|
+
x: d.dims.x,
|
|
451
|
+
y: d.dims.y + d.dims.h
|
|
447
452
|
});
|
|
448
453
|
}
|
|
449
454
|
}
|
|
@@ -457,12 +462,12 @@ class a {
|
|
|
457
462
|
nodName: this.name,
|
|
458
463
|
uidNode: this.unId
|
|
459
464
|
};
|
|
460
|
-
return this.open && (e.nodOpen = this.open), t.length > 0 && (e.nodKids = t), e;
|
|
465
|
+
return this.open && (e.nodOpen = this.open), this.collapsed && (e.nodFold = !0), this === c.root && c.maximized && (e.nodMaxd = c.maximized), t.length > 0 && (e.nodKids = t), e;
|
|
461
466
|
}
|
|
462
467
|
}
|
|
463
|
-
class
|
|
468
|
+
class A {
|
|
464
469
|
dims = { w: 0, h: 0, x: 0, y: 0 };
|
|
465
|
-
unId =
|
|
470
|
+
unId = c.createId();
|
|
466
471
|
next = null;
|
|
467
472
|
prev = null;
|
|
468
473
|
host = null;
|
|
@@ -480,8 +485,8 @@ class O {
|
|
|
480
485
|
};
|
|
481
486
|
}
|
|
482
487
|
}
|
|
483
|
-
function*
|
|
484
|
-
const t = new
|
|
488
|
+
function* W(o) {
|
|
489
|
+
const t = new g();
|
|
485
490
|
for (t.enqueue(o); !t.isEmpty(); ) {
|
|
486
491
|
const e = t.dequeue();
|
|
487
492
|
if (e && (yield e, e.nodKids && e.nodKids.length > 0))
|
|
@@ -489,8 +494,8 @@ function* S(o) {
|
|
|
489
494
|
t.enqueue(n);
|
|
490
495
|
}
|
|
491
496
|
}
|
|
492
|
-
function*
|
|
493
|
-
const t = new
|
|
497
|
+
function* L(o) {
|
|
498
|
+
const t = new g();
|
|
494
499
|
for (t.enqueue(o); !t.isEmpty(); ) {
|
|
495
500
|
const e = t.dequeue();
|
|
496
501
|
if (e && (a.cache.mapElem.set(e.unId, e), yield e, e.kids.size() > 0))
|
|
@@ -498,12 +503,12 @@ function* R(o) {
|
|
|
498
503
|
t.enqueue(n);
|
|
499
504
|
}
|
|
500
505
|
}
|
|
501
|
-
function*
|
|
506
|
+
function* P(o, t) {
|
|
502
507
|
for (const e of t.kids)
|
|
503
508
|
yield* o.NodeLayoutRecursiveIterator(e);
|
|
504
509
|
yield t;
|
|
505
510
|
}
|
|
506
|
-
function
|
|
511
|
+
function K(o, t) {
|
|
507
512
|
const e = a.cache.mapDirs.get(t.unId);
|
|
508
513
|
if (e === void 0) {
|
|
509
514
|
console.warn(
|
|
@@ -514,19 +519,19 @@ function q(o, t) {
|
|
|
514
519
|
for (const n of t.kids)
|
|
515
520
|
a.cache.mapDirs.set(n.unId, !e), n.kids.size() > 0 && (n.host = t, o.updateChildDirections(n), n.next && a.cache.mapDirs.set(n.next.unId, !e));
|
|
516
521
|
}
|
|
517
|
-
function
|
|
522
|
+
function U(o, t = c.tree) {
|
|
518
523
|
if (!t) return;
|
|
519
|
-
const e = o.JSONLayoutIterator(t), n = o.NodeLayoutIterator(
|
|
520
|
-
for (a.cache.mapDirs.set(
|
|
524
|
+
const e = o.JSONLayoutIterator(t), n = o.NodeLayoutIterator(c.root);
|
|
525
|
+
for (a.cache.mapDirs.set(c.root.unId, !0); ; ) {
|
|
521
526
|
const i = e.next(), s = n.next();
|
|
522
527
|
if (i.done || s.done)
|
|
523
528
|
break;
|
|
524
|
-
const r = i.value,
|
|
525
|
-
!r || !
|
|
529
|
+
const r = i.value, h = s.value;
|
|
530
|
+
!r || !h || o.createNodeTreeFromJSONTree(r, h);
|
|
526
531
|
}
|
|
527
532
|
o.calcTabsetCountAndMinDim();
|
|
528
533
|
}
|
|
529
|
-
function
|
|
534
|
+
function $(o, t, e) {
|
|
530
535
|
const n = a.cache.mapDirs.get(e.unId);
|
|
531
536
|
for (const i of t.nodKids || []) {
|
|
532
537
|
const s = o.createNodeFromJSON(i), r = e.kids.peekBack();
|
|
@@ -534,39 +539,49 @@ function M(o, t, e) {
|
|
|
534
539
|
}
|
|
535
540
|
e.type === "tabset" && a.cache.mapElem.set(e.unId, e), e.type === "tab" && a.cache.mapElem.set(e.unId, e);
|
|
536
541
|
}
|
|
537
|
-
function
|
|
538
|
-
const n = new
|
|
539
|
-
for (n.enqueue(e), a.cache.mapDirs.set(
|
|
542
|
+
function _(o, t, e = c.root) {
|
|
543
|
+
const n = new g();
|
|
544
|
+
for (n.enqueue(e), a.cache.mapDirs.set(c.root.unId, !0); !t.isEmpty(); ) {
|
|
540
545
|
const i = n.dequeue();
|
|
541
546
|
if (!i)
|
|
542
547
|
break;
|
|
543
548
|
const s = a.cache.mapDirs.get(i.unId);
|
|
549
|
+
if (t.size() === 1) {
|
|
550
|
+
const d = t.dequeue(), l = new a({ type: "tabset", host: i }), m = new a({
|
|
551
|
+
type: "tab",
|
|
552
|
+
host: l,
|
|
553
|
+
name: d,
|
|
554
|
+
unId: o.tabsIds.get(d ?? "") ?? c.createId()
|
|
555
|
+
});
|
|
556
|
+
l.open = m.name, l.kids.enqueue(m), i.kids.enqueue(l), a.cache.mapDirs.set(l.unId, !s), a.cache.mapDirs.set(m.unId, s), a.cache.mapElem.set(l.unId, l), a.cache.mapElem.set(m.unId, m);
|
|
557
|
+
break;
|
|
558
|
+
}
|
|
544
559
|
if (t.size() == 2) {
|
|
545
|
-
const
|
|
560
|
+
const d = t.dequeue(), l = t.dequeue(), m = new a({ type: "tabset", host: i }), p = new a({ type: "tabset", host: i }), I = new a({
|
|
546
561
|
type: "tab",
|
|
547
562
|
host: m,
|
|
548
|
-
name:
|
|
549
|
-
unId: o.tabsIds.get(
|
|
563
|
+
name: d,
|
|
564
|
+
unId: o.tabsIds.get(d ?? "") ?? c.createId()
|
|
550
565
|
}), y = new a({
|
|
551
566
|
type: "tab",
|
|
552
567
|
host: p,
|
|
553
|
-
name:
|
|
554
|
-
unId: o.tabsIds.get(
|
|
568
|
+
name: l,
|
|
569
|
+
unId: o.tabsIds.get(l ?? "") ?? c.createId()
|
|
555
570
|
});
|
|
556
571
|
m.open = I.name, p.open = y.name, m.kids.enqueue(I), p.kids.enqueue(y), i.kids.enqueue(m), i.kids.enqueue(p), p.addBond(i, m), a.cache.mapDirs.set(m.unId, !s), a.cache.mapDirs.set(p.unId, !s), a.cache.mapElem.set(m.unId, m), a.cache.mapElem.set(p.unId, p), a.cache.mapDirs.set(I.unId, s), a.cache.mapDirs.set(y.unId, s), a.cache.mapElem.set(I.unId, I), a.cache.mapElem.set(y.unId, y);
|
|
557
572
|
break;
|
|
558
573
|
}
|
|
559
|
-
const r = t.dequeue(),
|
|
574
|
+
const r = t.dequeue(), h = new a({ type: "tabset", host: i }), u = new a({ type: "row", host: i }), f = new a({
|
|
560
575
|
type: "tab",
|
|
561
|
-
host:
|
|
576
|
+
host: h,
|
|
562
577
|
name: r,
|
|
563
|
-
unId: o.tabsIds.get(r ?? "") ??
|
|
578
|
+
unId: o.tabsIds.get(r ?? "") ?? c.createId()
|
|
564
579
|
});
|
|
565
|
-
|
|
580
|
+
h.open = f.name, h.kids.enqueue(f), i.kids.enqueue(h), i.kids.enqueue(u), u.addBond(i, h), a.cache.mapDirs.set(h.unId, !s), a.cache.mapDirs.set(u.unId, !s), a.cache.mapElem.set(h.unId, h), a.cache.mapDirs.set(f.unId, s), a.cache.mapElem.set(f.unId, f), n.enqueue(u);
|
|
566
581
|
}
|
|
567
582
|
o.calcTabsetCountAndMinDim();
|
|
568
583
|
}
|
|
569
|
-
function
|
|
584
|
+
function Y(o, t) {
|
|
570
585
|
const e = new a({
|
|
571
586
|
type: t.typNode,
|
|
572
587
|
name: t.nodName,
|
|
@@ -575,178 +590,252 @@ function F(o, t) {
|
|
|
575
590
|
dims: { w: 0, h: 0, x: 0, y: 0 },
|
|
576
591
|
open: typeof t.nodOpen == "string" ? t.nodOpen : ""
|
|
577
592
|
});
|
|
578
|
-
return t.typNode === "tab" && (e.unId = o.tabsIds.get(t.nodName) || t.uidNode), e;
|
|
593
|
+
return e.collapsed = t.typNode === "tabset" && t.nodFold === !0, t.typNode === "tab" && (e.unId = o.tabsIds.get(t.nodName) || t.uidNode), e;
|
|
594
|
+
}
|
|
595
|
+
function N(o) {
|
|
596
|
+
const t = a.cache.mapElem.get(o);
|
|
597
|
+
return t instanceof a && t.type === "tabset" ? t : null;
|
|
598
|
+
}
|
|
599
|
+
function G(o = c.root) {
|
|
600
|
+
let t = 0;
|
|
601
|
+
const e = (n) => {
|
|
602
|
+
n.type === "tabset" && t++;
|
|
603
|
+
for (const i of n.kids) e(i);
|
|
604
|
+
};
|
|
605
|
+
return e(o), t;
|
|
606
|
+
}
|
|
607
|
+
function v(o) {
|
|
608
|
+
return o.type === "tabset" && !!o.host && o.host.kids.size() > 1;
|
|
609
|
+
}
|
|
610
|
+
function S() {
|
|
611
|
+
return G() > 1;
|
|
612
|
+
}
|
|
613
|
+
function R() {
|
|
614
|
+
const o = c.maximized;
|
|
615
|
+
return o ? N(o) : null;
|
|
616
|
+
}
|
|
617
|
+
function H(o, t) {
|
|
618
|
+
let e = null;
|
|
619
|
+
for (const n of o.kids)
|
|
620
|
+
n === t || !n.collapsed || (!e || n.foldedAt > e.foldedAt) && (e = n);
|
|
621
|
+
e && (e.collapsed = !1);
|
|
622
|
+
}
|
|
623
|
+
function J(o = c.root) {
|
|
624
|
+
let t = !1;
|
|
625
|
+
const e = (n) => {
|
|
626
|
+
n.type === "tabset" && (n.unId === c.maximized && (t = !0), n.collapsed && !v(n) && (n.collapsed = !1)), n.type !== "tab" && n.kids.size() > 0 && [...n.kids].every((s) => s.collapsed) && H(n);
|
|
627
|
+
for (const i of n.kids) e(i);
|
|
628
|
+
};
|
|
629
|
+
e(o), t || (c.maximized = null);
|
|
630
|
+
}
|
|
631
|
+
function M(o, t) {
|
|
632
|
+
return !N(t) || !S() || c.maximized === t ? !1 : (c.maximized = t, o.calcDimensions(), !0);
|
|
633
|
+
}
|
|
634
|
+
function z(o) {
|
|
635
|
+
return c.maximized ? (c.maximized = null, o.calcDimensions(), !0) : !1;
|
|
636
|
+
}
|
|
637
|
+
function Q(o, t) {
|
|
638
|
+
return c.maximized === t ? z(o) : M(o, t);
|
|
639
|
+
}
|
|
640
|
+
function q(o, t) {
|
|
641
|
+
const e = N(t);
|
|
642
|
+
if (!e || e.collapsed || !v(e)) return !1;
|
|
643
|
+
c.maximized = null, e.collapsed = !0, e.foldedAt = ++c.foldSeq;
|
|
644
|
+
const n = e.host;
|
|
645
|
+
return [...n.kids].every((i) => i.collapsed) && H(n, e), o.calcTabsetCountAndMinDim(), o.calcDimensions(), !0;
|
|
646
|
+
}
|
|
647
|
+
function F(o, t) {
|
|
648
|
+
const e = N(t);
|
|
649
|
+
return !e || !e.collapsed ? !1 : (e.collapsed = !1, o.calcTabsetCountAndMinDim(), o.calcDimensions(), !0);
|
|
579
650
|
}
|
|
580
|
-
function
|
|
581
|
-
|
|
651
|
+
function j(o, t) {
|
|
652
|
+
const e = N(t);
|
|
653
|
+
return e ? e.collapsed ? F(o, t) : q(o, t) : !1;
|
|
654
|
+
}
|
|
655
|
+
function V(o, t = c.root, e = !0) {
|
|
656
|
+
t === c.root && e && (J(t), a.cache.tabCnts.clear(), a.cache.dimMins.clear(), a.cache.mapElem.clear(), a.cache.nodOpts.get().clear(), a.cache.bndOpts.get().clear());
|
|
582
657
|
for (const n of o.NodeLayoutRecursiveIterator(t)) {
|
|
583
658
|
const i = a.cache.tabCnts, s = a.cache.dimMins;
|
|
584
659
|
a.cache.mapElem.set(n.unId, n);
|
|
585
660
|
const r = i.set(n.unId, {
|
|
586
661
|
horizontal: 0,
|
|
587
662
|
vertical: 0
|
|
588
|
-
}).get(n.unId),
|
|
663
|
+
}).get(n.unId), h = s.set(n.unId, {
|
|
589
664
|
minWidth: 0,
|
|
590
665
|
minHeight: 0
|
|
591
|
-
}).get(n.unId),
|
|
666
|
+
}).get(n.unId), u = a.cache.mapDirs.get(n.unId);
|
|
592
667
|
if (n.type === "tab" && (a.cache.mapElem.set(n.unId, n), s.set(n.unId, {
|
|
593
668
|
minWidth: 0,
|
|
594
669
|
minHeight: 0
|
|
595
670
|
})), n.next && a.cache.mapElem.set(n.next.unId, n.next), n.type === "tabset" && (a.cache.mapElem.set(n.unId, n), s.set(n.unId, {
|
|
596
|
-
minWidth:
|
|
597
|
-
minHeight:
|
|
598
|
-
}),
|
|
671
|
+
minWidth: c.minW,
|
|
672
|
+
minHeight: c.minH
|
|
673
|
+
}), u ? i.set(n.unId, {
|
|
599
674
|
horizontal: 0,
|
|
600
675
|
vertical: 1
|
|
601
676
|
}) : i.set(n.unId, {
|
|
602
677
|
horizontal: 1,
|
|
603
678
|
vertical: 0
|
|
604
|
-
})
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
679
|
+
}), n.collapsed && n.host && (a.cache.mapDirs.get(n.host.unId) ? (s.set(n.unId, {
|
|
680
|
+
minWidth: c.collapsedSize,
|
|
681
|
+
minHeight: c.minH
|
|
682
|
+
}), i.get(n.unId).horizontal = 0) : (s.set(n.unId, {
|
|
683
|
+
minWidth: c.minW,
|
|
684
|
+
minHeight: c.collapsedSize
|
|
685
|
+
}), i.get(n.unId).vertical = 0))), n.type === "row") {
|
|
686
|
+
for (const f of n.kids) {
|
|
687
|
+
const d = i.get(f.unId), l = s.get(f.unId);
|
|
688
|
+
d && (r.horizontal += d.horizontal, r.vertical += d.vertical, u ? (h.minHeight = Math.max(
|
|
689
|
+
h.minHeight,
|
|
690
|
+
l.minHeight
|
|
691
|
+
), h.minWidth += l.minWidth) : (h.minHeight += l.minHeight, h.minWidth = Math.max(
|
|
692
|
+
h.minWidth,
|
|
693
|
+
l.minWidth
|
|
613
694
|
)));
|
|
614
695
|
}
|
|
615
|
-
|
|
696
|
+
u ? h.minWidth += (n.kids.size() - 1) * c.bond : h.minHeight += (n.kids.size() - 1) * c.bond;
|
|
616
697
|
}
|
|
617
698
|
}
|
|
618
|
-
t ===
|
|
699
|
+
t === c.root && e && o.pruneStaleDirections();
|
|
619
700
|
}
|
|
620
|
-
function
|
|
701
|
+
function X() {
|
|
621
702
|
for (const o of a.cache.mapDirs.keys())
|
|
622
703
|
a.cache.mapElem.has(o) || a.cache.mapDirs.delete(o);
|
|
623
704
|
}
|
|
624
|
-
function
|
|
625
|
-
const o =
|
|
626
|
-
let t = !1, e =
|
|
627
|
-
return
|
|
705
|
+
function Z() {
|
|
706
|
+
const o = c.root.getReqDimension();
|
|
707
|
+
let t = !1, e = c.root.dims.w, n = c.root.dims.h;
|
|
708
|
+
return c.root.dims.w < o.width && (e = o.width, t = !0), c.root.dims.h < o.height && (n = o.height, t = !0), t && (c.root.dims.w = e, c.root.dims.h = n), {
|
|
628
709
|
adjustedW: e,
|
|
629
710
|
adjustedH: n,
|
|
630
711
|
wasAdjusted: t
|
|
631
712
|
};
|
|
632
713
|
}
|
|
633
|
-
function
|
|
634
|
-
const n = t ===
|
|
714
|
+
function tt(o, t = c.root, e = !1) {
|
|
715
|
+
const n = t === c.root, i = (d) => n ? /* @__PURE__ */ new Map() : new Map(d.get()), s = i(a.cache.nodOpts), r = i(a.cache.bndOpts), h = i(a.cache.tabOpts);
|
|
635
716
|
n && o.calculateRootAdjustment();
|
|
717
|
+
const u = R(), f = S();
|
|
636
718
|
for (const d of o.NodeLayoutIterator(t)) {
|
|
637
719
|
d.calcDimensions();
|
|
638
720
|
const l = a.cache.mapDirs.get(d.unId);
|
|
639
721
|
if (d.type === "tabset") {
|
|
640
|
-
const
|
|
722
|
+
const m = d === u, p = !!u && !m, I = m ? { ...c.root.dims } : { ...d.dims }, y = {
|
|
641
723
|
typNode: d.type,
|
|
642
724
|
nodName: d.name,
|
|
643
725
|
uidNode: d.unId,
|
|
644
726
|
nodPart: d.part,
|
|
645
727
|
nodOpen: d.open,
|
|
646
728
|
nodeDir: l,
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
729
|
+
nodFold: d.collapsed && !m,
|
|
730
|
+
nodMaxd: m,
|
|
731
|
+
nodHidden: p,
|
|
732
|
+
nodFoldable: v(d),
|
|
733
|
+
nodMaximizable: f,
|
|
734
|
+
nodKids: Array.from(d.kids).map((b) => {
|
|
735
|
+
const k = {
|
|
736
|
+
typNode: b.type,
|
|
737
|
+
nodName: b.name,
|
|
738
|
+
uidNode: b.unId,
|
|
739
|
+
nodPart: b.part,
|
|
740
|
+
nodOpen: d.open === b.name,
|
|
654
741
|
nodeDir: !l,
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
}
|
|
742
|
+
nodHidden: p,
|
|
743
|
+
nodFold: d.collapsed && !m,
|
|
744
|
+
nodDims: { ...I }
|
|
658
745
|
};
|
|
659
|
-
return
|
|
746
|
+
return h.set(b.unId, k), k;
|
|
660
747
|
}),
|
|
661
|
-
nodDims:
|
|
662
|
-
...d.dims
|
|
663
|
-
}
|
|
748
|
+
nodDims: I
|
|
664
749
|
};
|
|
665
|
-
s.set(d.unId,
|
|
750
|
+
s.set(d.unId, y);
|
|
666
751
|
}
|
|
667
752
|
if (d.next && d.type !== "tab") {
|
|
668
|
-
const
|
|
753
|
+
const m = {
|
|
669
754
|
typNode: "bond",
|
|
670
755
|
nodName: d.name,
|
|
671
756
|
uidNode: d.next.unId,
|
|
672
757
|
nodeDir: l,
|
|
673
758
|
nodPart: 0,
|
|
759
|
+
nodHidden: !!u,
|
|
760
|
+
nodLocked: d.collapsed || !!d.next.next?.collapsed,
|
|
674
761
|
nodDims: {
|
|
675
762
|
...d.next.dims
|
|
676
763
|
}
|
|
677
764
|
};
|
|
678
|
-
r.set(d.next.unId,
|
|
765
|
+
r.set(d.next.unId, m);
|
|
679
766
|
}
|
|
680
767
|
}
|
|
681
|
-
a.cache.nodOpts.set(s, e), a.cache.bndOpts.set(r, e), a.cache.tabOpts.set(
|
|
768
|
+
a.cache.nodOpts.set(s, e), a.cache.bndOpts.set(r, e), a.cache.tabOpts.set(h, e);
|
|
682
769
|
}
|
|
683
|
-
function
|
|
684
|
-
if (
|
|
685
|
-
o.calcDimensions(
|
|
770
|
+
function et(o, t, e = !1, n = 2) {
|
|
771
|
+
if (c.root.dims = t, e) {
|
|
772
|
+
o.calcDimensions(c.root);
|
|
686
773
|
return;
|
|
687
774
|
}
|
|
688
|
-
o.cntdown && (
|
|
775
|
+
o.cntdown && (c.timer.clear(o.cntdown), o.cntdown = null), o.cntdown = c.timer.set(() => {
|
|
689
776
|
o.cntdown = null, o.calcDimensions();
|
|
690
777
|
}, n);
|
|
691
778
|
}
|
|
692
|
-
function
|
|
779
|
+
function nt(o, t, e, n = !1, i = 2) {
|
|
693
780
|
if (n) {
|
|
694
781
|
o.updateSliderDimension(t, e);
|
|
695
782
|
return;
|
|
696
783
|
}
|
|
697
|
-
o.cntdown && (
|
|
784
|
+
o.cntdown && (c.timer.clear(o.cntdown), o.cntdown = null), o.cntdown = c.timer.set(() => {
|
|
698
785
|
o.cntdown = null, o.updateSliderDimension(t, e);
|
|
699
786
|
}, i);
|
|
700
787
|
}
|
|
701
|
-
function
|
|
788
|
+
function it(o, t, e) {
|
|
702
789
|
const n = a.cache.mapElem.get(t);
|
|
703
|
-
if (!n || !(n instanceof
|
|
790
|
+
if (!n || !(n instanceof A)) {
|
|
704
791
|
console.warn(`Bond with id ${t} not found or is not a Bond instance`);
|
|
705
792
|
return;
|
|
706
793
|
}
|
|
707
|
-
const i = a.cache.mapDirs.get(n.host.unId), s = n.prev, r = n.next,
|
|
708
|
-
if (!s || !r || !
|
|
709
|
-
console.warn("Missing prev, next, or host node", s, r,
|
|
794
|
+
const i = a.cache.mapDirs.get(n.host.unId), s = n.prev, r = n.next, h = n.host;
|
|
795
|
+
if (!s || !r || !h) {
|
|
796
|
+
console.warn("Missing prev, next, or host node", s, r, h);
|
|
710
797
|
return;
|
|
711
798
|
}
|
|
712
|
-
|
|
799
|
+
if (s.collapsed || r.collapsed || c.maximized)
|
|
800
|
+
return;
|
|
801
|
+
const u = a.cache.dimMins.get(s.unId) || {
|
|
713
802
|
minWidth: 0,
|
|
714
803
|
minHeight: 0
|
|
715
|
-
},
|
|
804
|
+
}, f = a.cache.dimMins.get(r.unId) || {
|
|
716
805
|
minWidth: 0,
|
|
717
806
|
minHeight: 0
|
|
718
|
-
},
|
|
807
|
+
}, d = c.bond / 2;
|
|
719
808
|
if (i) {
|
|
720
|
-
const
|
|
721
|
-
n.dims.x = I -
|
|
722
|
-
const y = Math.max(0, s.dims.w -
|
|
723
|
-
k > 0 ? (s.part = y / k *
|
|
809
|
+
const l = r.dims.x + r.dims.w, m = s.dims.x + u.minWidth + d, p = l - f.minWidth - d, I = Math.max(m, Math.min(p, e.x));
|
|
810
|
+
n.dims.x = I - d, s.dims.w = n.dims.x - s.dims.x, r.dims.x = I + d, r.dims.w = l - r.dims.x;
|
|
811
|
+
const y = Math.max(0, s.dims.w - u.minWidth), b = Math.max(0, r.dims.w - f.minWidth), k = y + b, x = s.part + r.part;
|
|
812
|
+
k > 0 ? (s.part = y / k * x, r.part = b / k * x) : (s.part = x / 2, r.part = x / 2);
|
|
724
813
|
} else {
|
|
725
|
-
const
|
|
726
|
-
n.dims.y = I -
|
|
727
|
-
const y = Math.max(0, s.dims.h -
|
|
728
|
-
k > 0 ? (s.part = y / k *
|
|
814
|
+
const l = r.dims.y + r.dims.h, m = s.dims.y + u.minHeight + d, p = l - f.minHeight - d, I = Math.max(m, Math.min(p, e.y));
|
|
815
|
+
n.dims.y = I - d, s.dims.h = n.dims.y - s.dims.y, r.dims.y = I + d, r.dims.h = l - r.dims.y;
|
|
816
|
+
const y = Math.max(0, s.dims.h - u.minHeight), b = Math.max(0, r.dims.h - f.minHeight), k = y + b, x = s.part + r.part;
|
|
817
|
+
k > 0 ? (s.part = y / k * x, r.part = b / k * x) : (s.part = x / 2, r.part = x / 2);
|
|
729
818
|
}
|
|
730
|
-
o.calcDimensions(
|
|
819
|
+
o.calcDimensions(h);
|
|
731
820
|
}
|
|
732
|
-
function
|
|
821
|
+
function ot(o, t, e, n) {
|
|
733
822
|
const i = a.cache.mapElem.get(t);
|
|
734
823
|
let s = a.cache.mapElem.get(e);
|
|
735
824
|
return !i || !(i instanceof a) || !s || !(s instanceof a) ? (console.warn(`Source node ${t} not found or is not a Node instance`), !1) : i?.type == "tab" && i.host === s && s.kids.size() < 2 ? (console.warn("Cannot move to self as it has only one tab"), !1) : i?.type == "tabset" && s?.host === i ? (console.warn("Cannot move tabset to self as it is already a child"), !1) : !i || !s ? (console.warn(`Source or destination node not found: ${t}, ${e}`), !1) : i === s ? (console.warn(
|
|
736
825
|
"Source and destination nodes are the same, no action taken."
|
|
737
826
|
), !1) : !i.host || !s.host && s.type !== "row" ? (console.warn(
|
|
738
827
|
`Source node or destination node's host is null: ${i.unId}, ${s.unId}`
|
|
739
|
-
), !1) : s.type === "row" && s !==
|
|
828
|
+
), !1) : s.type === "row" && s !== c.root ? (console.warn(`Cannot move relative to a nested row: ${s.unId}`), !1) : s.type === "row" && n === "contain" ? (console.warn(
|
|
740
829
|
`Cannot move to a row with 'contain' layout: ${s.unId}`
|
|
741
|
-
), !1) : i.type === "row" || (s.type === "tabset" && n === "contain" && (s = s.kids.peekBack() || s), i === s) ? !1 : o.isOnlyContent(i) ? (console.warn("Cannot move the only tabset or tab in the layout"), !1) : (s.type === "tab" && (n === "contain" || n === "left" || n === "right") ? o.moveNodeAsTab(i, s, n) : s.type === "row" && n !== "contain" ? o.moveRelativeToRoot(i, s, n) : s.type === "tabset" && n !== "contain" && o.moveRelativeToTabset(i, s, n), o.calcTabsetCountAndMinDim(), o.calcDimensions(
|
|
830
|
+
), !1) : i.type === "row" || (s.type === "tabset" && n === "contain" && (s = s.kids.peekBack() || s), i === s) ? !1 : o.isOnlyContent(i) ? (console.warn("Cannot move the only tabset or tab in the layout"), !1) : (c.maximized = null, i.collapsed = !1, s.type === "tab" && (n === "contain" || n === "left" || n === "right") ? o.moveNodeAsTab(i, s, n) : s.type === "row" && n !== "contain" ? o.moveRelativeToRoot(i, s, n) : s.type === "tabset" && n !== "contain" && o.moveRelativeToTabset(i, s, n), o.calcTabsetCountAndMinDim(), o.calcDimensions(c.root, !0), !0);
|
|
742
831
|
}
|
|
743
|
-
function
|
|
832
|
+
function st(o, t) {
|
|
744
833
|
let e = 0;
|
|
745
|
-
for (const n of o.NodeLayoutRecursiveIterator(
|
|
834
|
+
for (const n of o.NodeLayoutRecursiveIterator(c.root))
|
|
746
835
|
n.type === "tabset" && e++;
|
|
747
836
|
return e !== 1 ? !1 : t.type === "tabset" || t.type === "tab" && t.host?.kids.size() === 1;
|
|
748
837
|
}
|
|
749
|
-
function
|
|
838
|
+
function at(o, t, e, n) {
|
|
750
839
|
if (!e || !e.host) {
|
|
751
840
|
console.warn(`Destination node ${e.unId} has no host, cannot move.`);
|
|
752
841
|
return;
|
|
@@ -755,39 +844,39 @@ function G(o, t, e, n) {
|
|
|
755
844
|
const i = e.host, s = i.kids.indexOf(e);
|
|
756
845
|
if (s === void 0 || s === -1)
|
|
757
846
|
return;
|
|
758
|
-
const r = n === "contain" || n === "left",
|
|
759
|
-
if (!r &&
|
|
760
|
-
r ? (
|
|
847
|
+
const r = n === "contain" || n === "left", h = r ? s : s + 1, u = i.kids.get(h + 1), f = i.kids.get(h - 1), d = e.next, l = e.prev;
|
|
848
|
+
if (!r && d ? a.cache.mapElem.delete(d.unId) : r && l && a.cache.mapElem.delete(l.unId), t.type == "tab")
|
|
849
|
+
r ? (f && t.addBond(i, f), e.addBond(i, t)) : (t.addBond(i, e), u && u.addBond(i, t)), i.kids.insert(h, t), t.host = i, i.open = t.name, i.collapsed = !1;
|
|
761
850
|
else if (t.type == "tabset") {
|
|
762
851
|
const m = t.kids.peek(), p = t.kids.peekBack();
|
|
763
|
-
r ? (m &&
|
|
852
|
+
r ? (m && f && m.addBond(i, f), p && e && e.addBond(i, p)) : (m && e && m.addBond(i, e), p && u && u.addBond(i, p)), i.kids.insertQueue(h, t.kids);
|
|
764
853
|
for (const I of t.kids)
|
|
765
854
|
I.host = i, I.next && (I.next.host = i);
|
|
766
|
-
i.open = p ? p.name : "";
|
|
855
|
+
i.open = p ? p.name : "", i.collapsed = !1;
|
|
767
856
|
}
|
|
768
857
|
o.updateChildDirections(i);
|
|
769
858
|
}
|
|
770
|
-
const
|
|
859
|
+
const rt = {
|
|
771
860
|
root: (o, t) => o === t,
|
|
772
861
|
tabset: (o, t) => o !== t
|
|
773
862
|
};
|
|
774
|
-
function
|
|
863
|
+
function B(o, t, e, n, i) {
|
|
775
864
|
if (o.removeNode(t), t.type !== "tab" && t.type !== "tabset") return;
|
|
776
|
-
const s = a.cache.mapDirs.get(e.unId) === !1, r = n === "left" || n === "right",
|
|
777
|
-
let
|
|
778
|
-
t.type === "tab" && (
|
|
865
|
+
const s = a.cache.mapDirs.get(e.unId) === !1, r = n === "left" || n === "right", h = n === "top" || n === "left";
|
|
866
|
+
let u = t;
|
|
867
|
+
t.type === "tab" && (u = new a({ type: "tabset", host: e.host }), u.kids.enqueue(t), u.open = t.name, t.host = u), rt[i](s, r) ? o.insertNodeWithNewParent(u, e, h) : o.insertNode(e, u, h);
|
|
779
868
|
}
|
|
780
|
-
function
|
|
781
|
-
|
|
869
|
+
function dt(o, t, e, n) {
|
|
870
|
+
B(o, t, e, n, "root");
|
|
782
871
|
}
|
|
783
|
-
function
|
|
784
|
-
|
|
872
|
+
function ct(o, t, e, n) {
|
|
873
|
+
B(o, t, e, n, "tabset");
|
|
785
874
|
}
|
|
786
|
-
function
|
|
875
|
+
function ht(o, t, e, n) {
|
|
787
876
|
const i = t.host;
|
|
788
|
-
if (t ==
|
|
789
|
-
const
|
|
790
|
-
n ? (
|
|
877
|
+
if (t == c.root) {
|
|
878
|
+
const l = c.root.kids.peek(), m = c.root.kids.peekBack();
|
|
879
|
+
n ? (c.root.kids.enqueueFront(e), l && l.addBond(c.root, e)) : (c.root.kids.enqueue(e), m && e.addBond(c.root, m)), e.host = c.root, o.updateChildDirections(c.root);
|
|
791
880
|
return;
|
|
792
881
|
}
|
|
793
882
|
if (!i) {
|
|
@@ -803,79 +892,79 @@ function X(o, t, e, n) {
|
|
|
803
892
|
}
|
|
804
893
|
const r = a.cache.mapDirs.get(i.unId);
|
|
805
894
|
r && a.cache.mapDirs.set(e.unId, !r);
|
|
806
|
-
const
|
|
807
|
-
e.host = i, n ? (i.kids.insert(s, e), t.addBond(i, e),
|
|
895
|
+
const h = i.kids.get(s + 1), u = i.kids.get(s - 1), f = t.next, d = t.prev;
|
|
896
|
+
e.host = i, n ? (i.kids.insert(s, e), t.addBond(i, e), u && e.addBond(i, u), d && a.cache.mapElem.delete(d.unId)) : (i.kids.insert(s + 1, e), e.addBond(i, t), h && h.addBond(i, e), f && a.cache.mapElem.delete(f.unId)), o.updateChildDirections(i);
|
|
808
897
|
}
|
|
809
|
-
function
|
|
810
|
-
const i = new
|
|
898
|
+
function ut(o, t, e, n) {
|
|
899
|
+
const i = new g(), s = new a({ type: "tabset", host: e.host });
|
|
811
900
|
if (!e || !t) {
|
|
812
901
|
console.warn(`Destination node ${e.unId} has no host, cannot insert.`);
|
|
813
902
|
return;
|
|
814
903
|
}
|
|
815
|
-
if (e ===
|
|
816
|
-
const
|
|
904
|
+
if (e === c.root) {
|
|
905
|
+
const h = new a({ type: "row", host: e });
|
|
817
906
|
if (e.kids.size() === 0)
|
|
818
907
|
e.kids.enqueue(t), t.host = e;
|
|
819
908
|
else if (e.kids.size() == 1 && e.kids.peek()?.type === "tabset") {
|
|
820
|
-
const
|
|
821
|
-
if (!
|
|
909
|
+
const u = e.kids.dequeue();
|
|
910
|
+
if (!u) {
|
|
822
911
|
console.warn(
|
|
823
912
|
`No kid found in destination node ${e.unId}, cannot insert.`
|
|
824
913
|
);
|
|
825
914
|
return;
|
|
826
915
|
}
|
|
827
|
-
n ? (
|
|
916
|
+
n ? (h.kids.enqueue(t), h.kids.enqueue(u), e.kids.enqueue(h), u.addBond(h, t)) : (h.kids.enqueue(u), h.kids.enqueue(t), t.addBond(h, u), e.kids.enqueue(h)), t.host = h, u.host = h;
|
|
828
917
|
} else if (e.kids.size() == 1 && e.kids.peek()?.type === "row") {
|
|
829
|
-
const
|
|
830
|
-
n &&
|
|
918
|
+
const u = e.kids.peek(), f = u?.kids.peek(), d = u?.kids.peekBack();
|
|
919
|
+
n && u ? (u.kids.enqueueFront(t), f && f.addBond(u, t)) : u && (u.kids.enqueue(t), d && t.addBond(u, d)), t.host = u;
|
|
831
920
|
} else if (e.kids.size() > 1) {
|
|
832
|
-
const
|
|
833
|
-
for (const
|
|
834
|
-
|
|
835
|
-
t.host =
|
|
921
|
+
const u = new a({ type: "row", host: e }), f = new a({ type: "row", host: u });
|
|
922
|
+
for (const d of e.kids)
|
|
923
|
+
f.kids.enqueue(d), d.host = f, d.next && (d.next.host = f);
|
|
924
|
+
t.host = u, e.kids.clear(), n ? (u.kids.enqueueFront(t), u.kids.enqueue(f), f.addBond(u, t)) : (u.kids.enqueue(f), u.kids.enqueue(t), t.addBond(u, f)), e.kids.enqueue(u);
|
|
836
925
|
}
|
|
837
926
|
o.updateChildDirections(e);
|
|
838
927
|
return;
|
|
839
928
|
}
|
|
840
929
|
t.host = e, s.host = e, s.kids = e.kids, s.open = e.open;
|
|
841
930
|
const r = a.cache.mapDirs.get(e.unId);
|
|
842
|
-
for (const
|
|
843
|
-
|
|
844
|
-
for (const
|
|
845
|
-
|
|
931
|
+
for (const h of s.kids)
|
|
932
|
+
h.host = s, h.next && (h.next.host = s), a.cache.mapDirs.set(h.unId, r);
|
|
933
|
+
for (const h of t.kids)
|
|
934
|
+
h.host = t, h.next && (h.next.host = t), a.cache.mapDirs.set(h.unId, r);
|
|
846
935
|
a.cache.mapDirs.set(s.unId, !r), a.cache.mapDirs.set(t.unId, !r), n ? (i.enqueue(t), i.enqueue(s), e.kids = i, e.type = "row", s.addBond(e, t)) : (i.enqueue(s), i.enqueue(t), e.kids = i, e.type = "row", t.addBond(e, s));
|
|
847
936
|
}
|
|
848
|
-
function
|
|
937
|
+
function lt(o, t) {
|
|
849
938
|
if (!t.host || !t.host.host) {
|
|
850
939
|
console.warn(`Source node ${t.unId} has no host, cannot move.`);
|
|
851
940
|
return;
|
|
852
941
|
}
|
|
853
|
-
const e = t.host, n = t.host.host, i = n.kids.indexOf(e), s = n.kids.get(i - 1), r = n.kids.get(i + 1),
|
|
942
|
+
const e = t.host, n = t.host.host, i = n.kids.indexOf(e), s = n.kids.get(i - 1), r = n.kids.get(i + 1), h = t.kids.peek(), u = t.kids.peekBack();
|
|
854
943
|
o.removeKid(e);
|
|
855
|
-
let
|
|
944
|
+
let f = i;
|
|
856
945
|
if (t.type == "row" && e) {
|
|
857
|
-
s &&
|
|
858
|
-
for (const
|
|
859
|
-
|
|
860
|
-
|
|
946
|
+
s && h && h.addBond(n, s), r && u && r.addBond(n, u);
|
|
947
|
+
for (const d of t.kids)
|
|
948
|
+
d.host = n, d.next && (d.next.host = n), n.kids.insert(f, d), a.cache.mapDirs.set(
|
|
949
|
+
d.unId,
|
|
861
950
|
!a.cache.mapDirs.get(n.unId)
|
|
862
|
-
), a.cache.dimMins.delete(
|
|
951
|
+
), a.cache.dimMins.delete(d.unId), f++;
|
|
863
952
|
} else if (t.type == "tabset") {
|
|
864
|
-
s && t.addBond(n, s), r && r.addBond(n, t), n.kids.insert(
|
|
865
|
-
for (const
|
|
953
|
+
s && t.addBond(n, s), r && r.addBond(n, t), n.kids.insert(f, t), t.host = n, a.cache.mapDirs.set(t.unId, !a.cache.mapDirs.get(n.unId));
|
|
954
|
+
for (const d of t.kids)
|
|
866
955
|
a.cache.mapDirs.set(
|
|
867
|
-
|
|
956
|
+
d.unId,
|
|
868
957
|
a.cache.mapDirs.get(n.unId)
|
|
869
|
-
), a.cache.dimMins.delete(
|
|
958
|
+
), a.cache.dimMins.delete(d.unId);
|
|
870
959
|
}
|
|
871
960
|
}
|
|
872
|
-
function
|
|
961
|
+
function ft(o, t = !0) {
|
|
873
962
|
const e = o.host, n = o.prev, i = o.next;
|
|
874
963
|
if (o.host = null, o.next = null, o.prev = null, n && (n.next = null), i && (i.prev = null), !t)
|
|
875
964
|
return o;
|
|
876
965
|
n && i && n.prev && i.next ? n.prev.addBond(e, i.next) : n && n.prev ? n.prev.next = null : i && i.next && (i.next.prev = null);
|
|
877
966
|
}
|
|
878
|
-
function
|
|
967
|
+
function mt(o, t) {
|
|
879
968
|
if (!t.host) {
|
|
880
969
|
console.warn("Kid node has no host, cannot remove.");
|
|
881
970
|
return;
|
|
@@ -895,7 +984,7 @@ function et(o, t) {
|
|
|
895
984
|
i && (e.open = i.name);
|
|
896
985
|
}
|
|
897
986
|
}
|
|
898
|
-
function
|
|
987
|
+
function pt(o) {
|
|
899
988
|
if (!o.host) {
|
|
900
989
|
console.warn("Kid node has no host, cannot remove.");
|
|
901
990
|
return;
|
|
@@ -907,45 +996,45 @@ function nt(o) {
|
|
|
907
996
|
}
|
|
908
997
|
s && a.cache.mapElem.delete(s.unId), r && a.cache.mapElem.delete(r.unId), n && i ? n.addBond(t, i) : n ? n.prev = null : i && (i.next = null), t.kids.removeAt(e), a.cache.mapElem.delete(o.unId), a.cache.dimMins.delete(o.unId), a.cache.mapDirs.delete(o.unId), a.cache.tabCnts.delete(o.unId), o.type === "tabset" && a.cache.mapElem.delete(o.unId), o.type === "tab" && a.cache.mapElem.delete(o.unId), o.host = null, o.next = null, o.prev = null;
|
|
909
998
|
}
|
|
910
|
-
function
|
|
999
|
+
function It() {
|
|
911
1000
|
a.cache.dimMins.clear(), a.cache.mapDirs.clear(), a.cache.tabCnts.clear(), a.cache.mapElem.clear(), a.cache.nodOpts.get().clear(), a.cache.bndOpts.get().clear();
|
|
912
1001
|
}
|
|
913
1002
|
class w {
|
|
914
1003
|
static get _root() {
|
|
915
|
-
return
|
|
1004
|
+
return c.root;
|
|
916
1005
|
}
|
|
917
1006
|
static set _root(t) {
|
|
918
|
-
|
|
1007
|
+
c.root = t;
|
|
919
1008
|
}
|
|
920
1009
|
static get _tree() {
|
|
921
|
-
return
|
|
1010
|
+
return c.tree;
|
|
922
1011
|
}
|
|
923
1012
|
static set _tree(t) {
|
|
924
|
-
|
|
1013
|
+
c.tree = t;
|
|
925
1014
|
}
|
|
926
1015
|
static get _minW() {
|
|
927
|
-
return
|
|
1016
|
+
return c.minW;
|
|
928
1017
|
}
|
|
929
1018
|
static set _minW(t) {
|
|
930
|
-
|
|
1019
|
+
c.minW = t;
|
|
931
1020
|
}
|
|
932
1021
|
static get _minH() {
|
|
933
|
-
return
|
|
1022
|
+
return c.minH;
|
|
934
1023
|
}
|
|
935
1024
|
static set _minH(t) {
|
|
936
|
-
|
|
1025
|
+
c.minH = t;
|
|
937
1026
|
}
|
|
938
1027
|
static get _bond() {
|
|
939
|
-
return
|
|
1028
|
+
return c.bond;
|
|
940
1029
|
}
|
|
941
1030
|
static set _bond(t) {
|
|
942
|
-
|
|
1031
|
+
c.bond = t;
|
|
943
1032
|
}
|
|
944
1033
|
static get _inst() {
|
|
945
|
-
return
|
|
1034
|
+
return c.inst;
|
|
946
1035
|
}
|
|
947
1036
|
static set _inst(t) {
|
|
948
|
-
|
|
1037
|
+
c.inst = t;
|
|
949
1038
|
}
|
|
950
1039
|
nodeOps;
|
|
951
1040
|
cntdown = null;
|
|
@@ -961,109 +1050,130 @@ class w {
|
|
|
961
1050
|
tabsIds: /* @__PURE__ */ new Map(),
|
|
962
1051
|
...t
|
|
963
1052
|
};
|
|
964
|
-
this.tabsIds = e.tabsIds,
|
|
1053
|
+
this.tabsIds = e.tabsIds, c.createId = e.createId ?? D, c.timer = e.timer ?? O, c.collapsedSize = e.collapsedSize ?? e.minH, w._tree = e.tree ?? null, c.maximized = e.tree?.nodMaxd ?? null, w._root = new a({
|
|
965
1054
|
unId: e.uqid,
|
|
966
1055
|
name: e.uqid,
|
|
967
1056
|
type: "row"
|
|
968
|
-
}), this.nodeOps =
|
|
1057
|
+
}), this.nodeOps = T(
|
|
969
1058
|
/* @__PURE__ */ new Map(),
|
|
970
1059
|
E
|
|
971
1060
|
), w._minW = e.minW, w._minH = e.minH, w._bond = e.bond;
|
|
972
|
-
const n = new
|
|
1061
|
+
const n = new g(e.tabs.length, e.tabs);
|
|
973
1062
|
w._tree ? this.createNodeLayout() : this.createBinaryNodeTreeFromQueue(n), w._inst = this;
|
|
974
1063
|
}
|
|
975
1064
|
*JSONLayoutIterator(t) {
|
|
976
|
-
yield*
|
|
1065
|
+
yield* W(t);
|
|
977
1066
|
}
|
|
978
1067
|
*NodeLayoutIterator(t) {
|
|
979
|
-
yield*
|
|
1068
|
+
yield* L(t);
|
|
980
1069
|
}
|
|
981
1070
|
*NodeLayoutRecursiveIterator(t) {
|
|
982
|
-
yield*
|
|
1071
|
+
yield* P(this, t);
|
|
983
1072
|
}
|
|
984
1073
|
updateChildDirections(t) {
|
|
985
|
-
return
|
|
1074
|
+
return K(this, t);
|
|
986
1075
|
}
|
|
987
1076
|
createNodeLayout(t = w._tree) {
|
|
988
|
-
return
|
|
1077
|
+
return U(this, t);
|
|
989
1078
|
}
|
|
990
1079
|
createNodeTreeFromJSONTree(t, e) {
|
|
991
|
-
return
|
|
1080
|
+
return $(this, t, e);
|
|
992
1081
|
}
|
|
993
1082
|
createBinaryNodeTreeFromQueue(t, e = w._root) {
|
|
994
|
-
return
|
|
1083
|
+
return _(this, t, e);
|
|
995
1084
|
}
|
|
996
1085
|
createNodeFromJSON(t) {
|
|
997
|
-
return
|
|
1086
|
+
return Y(this, t);
|
|
998
1087
|
}
|
|
999
1088
|
calcTabsetCountAndMinDim(t = w._root, e = !0) {
|
|
1000
|
-
return
|
|
1089
|
+
return V(this, t, e);
|
|
1001
1090
|
}
|
|
1002
1091
|
pruneStaleDirections() {
|
|
1003
|
-
return
|
|
1092
|
+
return X();
|
|
1004
1093
|
}
|
|
1005
1094
|
calculateRootAdjustment() {
|
|
1006
|
-
return
|
|
1095
|
+
return Z();
|
|
1007
1096
|
}
|
|
1008
1097
|
calcDimensions(t = w._root, e = !1) {
|
|
1009
|
-
return
|
|
1098
|
+
return tt(this, t, e);
|
|
1010
1099
|
}
|
|
1011
1100
|
updateDimension(t, e = !1, n = 2) {
|
|
1012
|
-
return
|
|
1101
|
+
return et(this, t, e, n);
|
|
1013
1102
|
}
|
|
1014
1103
|
updateSlider(t, e, n = !1, i = 2) {
|
|
1015
|
-
return
|
|
1104
|
+
return nt(this, t, e, n, i);
|
|
1016
1105
|
}
|
|
1017
1106
|
updateSliderDimension(t, e) {
|
|
1018
|
-
return
|
|
1107
|
+
return it(this, t, e);
|
|
1019
1108
|
}
|
|
1020
1109
|
updateTree(t, e, n) {
|
|
1021
|
-
return
|
|
1110
|
+
return ot(this, t, e, n);
|
|
1022
1111
|
}
|
|
1023
1112
|
isOnlyContent(t) {
|
|
1024
|
-
return
|
|
1113
|
+
return st(this, t);
|
|
1025
1114
|
}
|
|
1026
1115
|
moveNodeAsTab(t, e, n) {
|
|
1027
|
-
return
|
|
1116
|
+
return at(this, t, e, n);
|
|
1028
1117
|
}
|
|
1029
1118
|
moveRelativeToRoot(t, e, n) {
|
|
1030
|
-
return
|
|
1119
|
+
return dt(this, t, e, n);
|
|
1031
1120
|
}
|
|
1032
1121
|
moveRelativeToTabset(t, e, n) {
|
|
1033
|
-
return
|
|
1122
|
+
return ct(this, t, e, n);
|
|
1034
1123
|
}
|
|
1035
1124
|
insertNode(t, e, n) {
|
|
1036
|
-
return
|
|
1125
|
+
return ht(this, t, e, n);
|
|
1037
1126
|
}
|
|
1038
1127
|
insertNodeWithNewParent(t, e, n) {
|
|
1039
|
-
return
|
|
1128
|
+
return ut(this, t, e, n);
|
|
1040
1129
|
}
|
|
1041
1130
|
moveAdjacentNodeToGrandParent(t) {
|
|
1042
|
-
return
|
|
1131
|
+
return lt(this, t);
|
|
1043
1132
|
}
|
|
1044
1133
|
removeRelation(t, e = !0) {
|
|
1045
|
-
return
|
|
1134
|
+
return ft(t, e);
|
|
1046
1135
|
}
|
|
1047
1136
|
removeNode(t) {
|
|
1048
|
-
return
|
|
1137
|
+
return mt(this, t);
|
|
1049
1138
|
}
|
|
1050
1139
|
removeKid(t) {
|
|
1051
|
-
return
|
|
1140
|
+
return pt(t);
|
|
1052
1141
|
}
|
|
1053
1142
|
clearAllCache() {
|
|
1054
|
-
return
|
|
1143
|
+
return It();
|
|
1144
|
+
}
|
|
1145
|
+
get maximizedId() {
|
|
1146
|
+
return R()?.unId ?? null;
|
|
1147
|
+
}
|
|
1148
|
+
maximize(t) {
|
|
1149
|
+
return M(this, t);
|
|
1150
|
+
}
|
|
1151
|
+
restore() {
|
|
1152
|
+
return z(this);
|
|
1153
|
+
}
|
|
1154
|
+
toggleMaximize(t) {
|
|
1155
|
+
return Q(this, t);
|
|
1156
|
+
}
|
|
1157
|
+
collapse(t) {
|
|
1158
|
+
return q(this, t);
|
|
1159
|
+
}
|
|
1160
|
+
expand(t) {
|
|
1161
|
+
return F(this, t);
|
|
1162
|
+
}
|
|
1163
|
+
toggleCollapse(t) {
|
|
1164
|
+
return j(this, t);
|
|
1055
1165
|
}
|
|
1056
1166
|
}
|
|
1057
|
-
const
|
|
1058
|
-
function
|
|
1059
|
-
const { left: n, top: i, width: s, height: r } = o,
|
|
1060
|
-
return
|
|
1167
|
+
const yt = 6;
|
|
1168
|
+
function bt(o, t, e) {
|
|
1169
|
+
const { left: n, top: i, width: s, height: r } = o, h = t - n, u = e - i;
|
|
1170
|
+
return h < s / 3 ? { area: "left", left: n, top: i, width: s / 2, height: r } : h > 2 * s / 3 ? {
|
|
1061
1171
|
area: "right",
|
|
1062
1172
|
left: n + s / 2,
|
|
1063
1173
|
top: i,
|
|
1064
1174
|
width: s / 2,
|
|
1065
1175
|
height: r
|
|
1066
|
-
} :
|
|
1176
|
+
} : u < r / 3 ? { area: "top", left: n, top: i, width: s, height: r / 2 } : u > 2 * r / 3 ? {
|
|
1067
1177
|
area: "bottom",
|
|
1068
1178
|
left: n,
|
|
1069
1179
|
top: i + r / 2,
|
|
@@ -1077,7 +1187,7 @@ function st(o, t, e) {
|
|
|
1077
1187
|
height: r * 0.8
|
|
1078
1188
|
};
|
|
1079
1189
|
}
|
|
1080
|
-
function
|
|
1190
|
+
function kt(o, t) {
|
|
1081
1191
|
const { x: e, y: n, w: i, h: s } = o;
|
|
1082
1192
|
switch (t) {
|
|
1083
1193
|
case "left":
|
|
@@ -1102,10 +1212,10 @@ function at(o, t) {
|
|
|
1102
1212
|
};
|
|
1103
1213
|
}
|
|
1104
1214
|
}
|
|
1105
|
-
function
|
|
1215
|
+
function xt(o, t, e, n) {
|
|
1106
1216
|
if (t.length === 0 || n < o.top || n > o.bottom) return null;
|
|
1107
1217
|
const i = t[0], s = t[t.length - 1];
|
|
1108
|
-
let r =
|
|
1218
|
+
let r = yt;
|
|
1109
1219
|
if (e > s.right)
|
|
1110
1220
|
return {
|
|
1111
1221
|
index: t.length - 1,
|
|
@@ -1124,30 +1234,30 @@ function rt(o, t, e, n) {
|
|
|
1124
1234
|
width: r - 2,
|
|
1125
1235
|
height: i.height
|
|
1126
1236
|
};
|
|
1127
|
-
let
|
|
1237
|
+
let h = 0, u = 1 / 0, f = !1;
|
|
1128
1238
|
t.forEach((m, p) => {
|
|
1129
1239
|
const I = m.left + m.width / 2, y = Math.abs(e - I);
|
|
1130
|
-
y <
|
|
1240
|
+
y < u && (u = y, h = p, f = e < I);
|
|
1131
1241
|
});
|
|
1132
|
-
const
|
|
1133
|
-
t.length > 1 &&
|
|
1134
|
-
const
|
|
1242
|
+
const d = f ? h > 0 : h < t.length - 1;
|
|
1243
|
+
t.length > 1 && d && (r = t[1].left - i.right);
|
|
1244
|
+
const l = t[h];
|
|
1135
1245
|
return {
|
|
1136
|
-
index:
|
|
1137
|
-
area:
|
|
1138
|
-
left:
|
|
1139
|
-
top:
|
|
1246
|
+
index: h,
|
|
1247
|
+
area: f ? "left" : "right",
|
|
1248
|
+
left: f ? l.left - r + 1 : l.right + 1,
|
|
1249
|
+
top: l.top,
|
|
1140
1250
|
width: r - 2,
|
|
1141
|
-
height:
|
|
1251
|
+
height: l.height
|
|
1142
1252
|
};
|
|
1143
1253
|
}
|
|
1144
|
-
function
|
|
1254
|
+
function gt(o, t) {
|
|
1145
1255
|
return o.area === t.area && o.left === t.left && o.top === t.top && o.width === t.width && o.height === t.height;
|
|
1146
1256
|
}
|
|
1147
|
-
function
|
|
1257
|
+
function wt(o, { x: t, y: e, w: n, h: i }) {
|
|
1148
1258
|
o.style.left = `${t}px`, o.style.top = `${e}px`, o.style.width = `${n}px`, o.style.height = `${i}px`;
|
|
1149
1259
|
}
|
|
1150
|
-
function
|
|
1260
|
+
function Nt(o, t) {
|
|
1151
1261
|
return {
|
|
1152
1262
|
x: o.x,
|
|
1153
1263
|
y: o.y + t,
|
|
@@ -1155,7 +1265,14 @@ function ht(o, t) {
|
|
|
1155
1265
|
h: Math.max(0, o.h - t)
|
|
1156
1266
|
};
|
|
1157
1267
|
}
|
|
1158
|
-
function
|
|
1268
|
+
function Tt(o, t) {
|
|
1269
|
+
const { x: e, y: n, w: i, h: s } = o.nodDims, r = o.nodeDir === !1;
|
|
1270
|
+
return o.nodFold && r ? { rect: { x: e + i, y: n, w: s, h: i }, rotated: !0 } : { rect: { x: e, y: n, w: i, h: t }, rotated: !1 };
|
|
1271
|
+
}
|
|
1272
|
+
function Et(o, t) {
|
|
1273
|
+
wt(o, t.rect), o.style.transformOrigin = "0 0", o.style.transform = t.rotated ? "rotate(90deg)" : "";
|
|
1274
|
+
}
|
|
1275
|
+
function vt(o) {
|
|
1159
1276
|
let t = null, e = null;
|
|
1160
1277
|
const n = () => {
|
|
1161
1278
|
e = null;
|
|
@@ -1245,18 +1362,20 @@ SOFTWARE.
|
|
|
1245
1362
|
});
|
|
1246
1363
|
})();
|
|
1247
1364
|
export {
|
|
1248
|
-
|
|
1365
|
+
A as Bond,
|
|
1249
1366
|
w as DynamixLayoutCore,
|
|
1250
1367
|
a as Node,
|
|
1251
|
-
|
|
1252
|
-
|
|
1368
|
+
g as Queue,
|
|
1369
|
+
C as areNodeOptionsEqual,
|
|
1253
1370
|
E as areNodeOptionsMapEqual,
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1371
|
+
vt as createFrameScheduler,
|
|
1372
|
+
T as createReactiveState,
|
|
1373
|
+
xt as getNavbarDropPreview,
|
|
1374
|
+
kt as getRootSplitPreview,
|
|
1375
|
+
Nt as getTabBodyRect,
|
|
1376
|
+
Tt as getTabbarPlacement,
|
|
1377
|
+
bt as getTabsetDropPreview,
|
|
1378
|
+
gt as isSameDropPreview,
|
|
1379
|
+
Et as placeTabbar,
|
|
1380
|
+
wt as setElementRect
|
|
1262
1381
|
};
|