@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/dist/core.es.js CHANGED
@@ -1,4 +1,4 @@
1
- class b {
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 c = e.toArray();
54
- for (let d = c.length - 1; d >= 0; d--)
55
- this.enqueueFront(c[d]);
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 c of e)
60
- this.enqueue(c);
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 x(o, t = (e, n) => e === n) {
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 = (f, m = !1) => {
293
+ const s = () => e, r = (l, m = !1) => {
294
294
  if (m) {
295
- e = f;
295
+ e = l;
296
296
  return;
297
297
  }
298
- t(e, f) || (e = f, n.forEach((p) => p(e)), i.forEach((p) => p(e)), i = []);
299
- }, c = () => {
300
- n.forEach((f) => f(e)), i.forEach((f) => f(e)), i = [];
301
- }, d = (f) => (n.add(f), () => n.delete(f)), l = () => new Promise((f) => {
302
- i.push(f);
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: d,
308
- nextChange: l,
309
- triggerChange: c,
310
- onChangePromise: (f) => {
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 l();
314
+ const I = await f();
315
315
  if (!m) break;
316
- f(I);
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 || !A(n, i))
328
+ if (!i || !C(n, i))
329
329
  return !1;
330
330
  }
331
331
  return !0;
332
332
  }
333
- function A(o, t) {
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 v = () => crypto.randomUUID(), T = {
338
+ const D = () => crypto.randomUUID(), O = {
339
339
  set: (o, t) => setTimeout(o, t),
340
340
  clear: (o) => clearTimeout(o)
341
- }, u = {
342
- createId: v,
343
- timer: T,
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: x(
360
+ tabOpts: T(
358
361
  /* @__PURE__ */ new Map(),
359
362
  E
360
363
  ),
361
- nodOpts: x(
364
+ nodOpts: T(
362
365
  /* @__PURE__ */ new Map(),
363
366
  E
364
367
  ),
365
- bndOpts: x(
368
+ bndOpts: T(
366
369
  /* @__PURE__ */ new Map(),
367
370
  E
368
371
  )
369
372
  };
370
- kids = new b();
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: u.createId(),
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 O(t, this, e);
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 * u.minW + Math.max(0, e.horizontal - 1) * u.bond
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 * u.minH + Math.max(0, e.vertical - 1) * u.bond
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 h of this.kids)
420
- e += h.part;
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 s;
423
- t ? s = this.dims.w - n.minWidth : s = this.dims.h - n.minHeight;
424
- const r = s < 0, c = this.kids.peekBack();
425
- let d = 0, l = 0;
426
- for (const h of this.kids) {
427
- const f = a.cache.dimMins.get(h.unId) || {
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 (!r) {
433
- d += h.part;
434
- const p = h === c ? s : Math.round(s * d / e);
435
- m = p - l, l = 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 ? (h.dims.w = f.minWidth + m, h.dims.h = this.dims.h, h.dims.x = this.dims.x + i, h.dims.y = this.dims.y, i += h.dims.w + u.bond) : (h.dims.h = f.minHeight + m, h.dims.w = this.dims.w, h.dims.y = this.dims.y + i, h.dims.x = this.dims.x, i += h.dims.h + u.bond), h.next && (t ? h.next.dims = {
438
- w: u.bond,
439
- h: h.dims.h,
440
- x: h.dims.x + h.dims.w,
441
- y: h.dims.y
442
- } : h.next.dims = {
443
- w: h.dims.w,
444
- h: u.bond,
445
- x: h.dims.x,
446
- y: h.dims.y + h.dims.h
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 O {
468
+ class A {
464
469
  dims = { w: 0, h: 0, x: 0, y: 0 };
465
- unId = u.createId();
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* S(o) {
484
- const t = new b();
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* R(o) {
493
- const t = new b();
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* H(o, t) {
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 q(o, t) {
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 B(o, t = u.tree) {
522
+ function U(o, t = c.tree) {
518
523
  if (!t) return;
519
- const e = o.JSONLayoutIterator(t), n = o.NodeLayoutIterator(u.root);
520
- for (a.cache.mapDirs.set(u.root.unId, !0); ; ) {
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, c = s.value;
525
- !r || !c || o.createNodeTreeFromJSONTree(r, c);
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 M(o, t, e) {
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 C(o, t, e = u.root) {
538
- const n = new b();
539
- for (n.enqueue(e), a.cache.mapDirs.set(u.root.unId, !0); !t.isEmpty(); ) {
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 h = t.dequeue(), f = t.dequeue(), m = new a({ type: "tabset", host: i }), p = new a({ type: "tabset", host: i }), I = new a({
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: h,
549
- unId: o.tabsIds.get(h ?? "") ?? u.createId()
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: f,
554
- unId: o.tabsIds.get(f ?? "") ?? u.createId()
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(), c = new a({ type: "tabset", host: i }), d = new a({ type: "row", host: i }), l = new a({
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: c,
576
+ host: h,
562
577
  name: r,
563
- unId: o.tabsIds.get(r ?? "") ?? u.createId()
578
+ unId: o.tabsIds.get(r ?? "") ?? c.createId()
564
579
  });
565
- c.open = l.name, c.kids.enqueue(l), i.kids.enqueue(c), i.kids.enqueue(d), d.addBond(i, c), a.cache.mapDirs.set(c.unId, !s), a.cache.mapDirs.set(d.unId, !s), a.cache.mapElem.set(c.unId, c), a.cache.mapDirs.set(l.unId, s), a.cache.mapElem.set(l.unId, l), n.enqueue(d);
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 F(o, t) {
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 W(o, t = u.root, e = !0) {
581
- t === u.root && e && (a.cache.tabCnts.clear(), a.cache.dimMins.clear(), a.cache.mapElem.clear(), a.cache.nodOpts.get().clear(), a.cache.bndOpts.get().clear());
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), c = s.set(n.unId, {
663
+ }).get(n.unId), h = s.set(n.unId, {
589
664
  minWidth: 0,
590
665
  minHeight: 0
591
- }).get(n.unId), d = a.cache.mapDirs.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: u.minW,
597
- minHeight: u.minH
598
- }), d ? i.set(n.unId, {
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
- })), n.type === "row") {
605
- for (const l of n.kids) {
606
- const h = i.get(l.unId), f = s.get(l.unId);
607
- h && (r.horizontal += h.horizontal, r.vertical += h.vertical, d ? (c.minHeight = Math.max(
608
- c.minHeight,
609
- f.minHeight
610
- ), c.minWidth += f.minWidth) : (c.minHeight += f.minHeight, c.minWidth = Math.max(
611
- c.minWidth,
612
- f.minWidth
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
- d ? c.minWidth += (n.kids.size() - 1) * u.bond : c.minHeight += (n.kids.size() - 1) * u.bond;
696
+ u ? h.minWidth += (n.kids.size() - 1) * c.bond : h.minHeight += (n.kids.size() - 1) * c.bond;
616
697
  }
617
698
  }
618
- t === u.root && e && o.pruneStaleDirections();
699
+ t === c.root && e && o.pruneStaleDirections();
619
700
  }
620
- function L() {
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 P() {
625
- const o = u.root.getReqDimension();
626
- let t = !1, e = u.root.dims.w, n = u.root.dims.h;
627
- return u.root.dims.w < o.width && (e = o.width, t = !0), u.root.dims.h < o.height && (n = o.height, t = !0), t && (u.root.dims.w = e, u.root.dims.h = n), {
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 z(o, t = u.root, e = !1) {
634
- const n = t === u.root, i = (d) => n ? /* @__PURE__ */ new Map() : new Map(d.get()), s = i(a.cache.nodOpts), r = i(a.cache.bndOpts), c = i(a.cache.tabOpts);
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 h = {
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
- nodKids: Array.from(d.kids).map((f) => {
648
- const m = {
649
- typNode: f.type,
650
- nodName: f.name,
651
- uidNode: f.unId,
652
- nodPart: f.part,
653
- nodOpen: d.open === f.name,
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
- nodDims: {
656
- ...d.dims
657
- }
742
+ nodHidden: p,
743
+ nodFold: d.collapsed && !m,
744
+ nodDims: { ...I }
658
745
  };
659
- return c.set(f.unId, m), m;
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, h);
750
+ s.set(d.unId, y);
666
751
  }
667
752
  if (d.next && d.type !== "tab") {
668
- const h = {
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, h);
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(c, e);
768
+ a.cache.nodOpts.set(s, e), a.cache.bndOpts.set(r, e), a.cache.tabOpts.set(h, e);
682
769
  }
683
- function K(o, t, e = !1, n = 2) {
684
- if (u.root.dims = t, e) {
685
- o.calcDimensions(u.root);
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 && (u.timer.clear(o.cntdown), o.cntdown = null), o.cntdown = u.timer.set(() => {
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 U(o, t, e, n = !1, i = 2) {
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 && (u.timer.clear(o.cntdown), o.cntdown = null), o.cntdown = u.timer.set(() => {
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 $(o, t, e) {
788
+ function it(o, t, e) {
702
789
  const n = a.cache.mapElem.get(t);
703
- if (!n || !(n instanceof O)) {
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, c = n.host;
708
- if (!s || !r || !c) {
709
- console.warn("Missing prev, next, or host node", s, r, c);
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
- const d = a.cache.dimMins.get(s.unId) || {
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
- }, l = a.cache.dimMins.get(r.unId) || {
804
+ }, f = a.cache.dimMins.get(r.unId) || {
716
805
  minWidth: 0,
717
806
  minHeight: 0
718
- }, h = u.bond / 2;
807
+ }, d = c.bond / 2;
719
808
  if (i) {
720
- const f = r.dims.x + r.dims.w, m = s.dims.x + d.minWidth + h, p = f - l.minWidth - h, I = Math.max(m, Math.min(p, e.x));
721
- n.dims.x = I - h, s.dims.w = n.dims.x - s.dims.x, r.dims.x = I + h, r.dims.w = f - r.dims.x;
722
- const y = Math.max(0, s.dims.w - d.minWidth), g = Math.max(0, r.dims.w - l.minWidth), k = y + g, N = s.part + r.part;
723
- k > 0 ? (s.part = y / k * N, r.part = g / k * N) : (s.part = N / 2, r.part = N / 2);
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 f = r.dims.y + r.dims.h, m = s.dims.y + d.minHeight + h, p = f - l.minHeight - h, I = Math.max(m, Math.min(p, e.y));
726
- n.dims.y = I - h, s.dims.h = n.dims.y - s.dims.y, r.dims.y = I + h, r.dims.h = f - r.dims.y;
727
- const y = Math.max(0, s.dims.h - d.minHeight), g = Math.max(0, r.dims.h - l.minHeight), k = y + g, N = s.part + r.part;
728
- k > 0 ? (s.part = y / k * N, r.part = g / k * N) : (s.part = N / 2, r.part = N / 2);
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(c);
819
+ o.calcDimensions(h);
731
820
  }
732
- function _(o, t, e, n) {
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 !== u.root ? (console.warn(`Cannot move relative to a nested row: ${s.unId}`), !1) : s.type === "row" && n === "contain" ? (console.warn(
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(u.root, !0), !0);
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 Y(o, t) {
832
+ function st(o, t) {
744
833
  let e = 0;
745
- for (const n of o.NodeLayoutRecursiveIterator(u.root))
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 G(o, t, e, n) {
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", c = r ? s : s + 1, d = i.kids.get(c + 1), l = i.kids.get(c - 1), h = e.next, f = e.prev;
759
- if (!r && h ? a.cache.mapElem.delete(h.unId) : r && f && a.cache.mapElem.delete(f.unId), t.type == "tab")
760
- r ? (l && t.addBond(i, l), e.addBond(i, t)) : (t.addBond(i, e), d && d.addBond(i, t)), i.kids.insert(c, t), t.host = i, i.open = t.name;
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 && l && m.addBond(i, l), p && e && e.addBond(i, p)) : (m && e && m.addBond(i, e), p && d && d.addBond(i, p)), i.kids.insertQueue(c, t.kids);
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 J = {
859
+ const rt = {
771
860
  root: (o, t) => o === t,
772
861
  tabset: (o, t) => o !== t
773
862
  };
774
- function D(o, t, e, n, i) {
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", c = n === "top" || n === "left";
777
- let d = t;
778
- t.type === "tab" && (d = new a({ type: "tabset", host: e.host }), d.kids.enqueue(t), d.open = t.name, t.host = d), J[i](s, r) ? o.insertNodeWithNewParent(d, e, c) : o.insertNode(e, d, c);
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 Q(o, t, e, n) {
781
- D(o, t, e, n, "root");
869
+ function dt(o, t, e, n) {
870
+ B(o, t, e, n, "root");
782
871
  }
783
- function j(o, t, e, n) {
784
- D(o, t, e, n, "tabset");
872
+ function ct(o, t, e, n) {
873
+ B(o, t, e, n, "tabset");
785
874
  }
786
- function X(o, t, e, n) {
875
+ function ht(o, t, e, n) {
787
876
  const i = t.host;
788
- if (t == u.root) {
789
- const f = u.root.kids.peek(), m = u.root.kids.peekBack();
790
- n ? (u.root.kids.enqueueFront(e), f && f.addBond(u.root, e)) : (u.root.kids.enqueue(e), m && e.addBond(u.root, m)), e.host = u.root, o.updateChildDirections(u.root);
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 c = i.kids.get(s + 1), d = i.kids.get(s - 1), l = t.next, h = t.prev;
807
- e.host = i, n ? (i.kids.insert(s, e), t.addBond(i, e), d && e.addBond(i, d), h && a.cache.mapElem.delete(h.unId)) : (i.kids.insert(s + 1, e), e.addBond(i, t), c && c.addBond(i, e), l && a.cache.mapElem.delete(l.unId)), o.updateChildDirections(i);
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 V(o, t, e, n) {
810
- const i = new b(), s = new a({ type: "tabset", host: e.host });
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 === u.root) {
816
- const c = new a({ type: "row", host: e });
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 d = e.kids.dequeue();
821
- if (!d) {
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 ? (c.kids.enqueue(t), c.kids.enqueue(d), e.kids.enqueue(c), d.addBond(c, t)) : (c.kids.enqueue(d), c.kids.enqueue(t), t.addBond(c, d), e.kids.enqueue(c)), t.host = c, d.host = c;
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 d = e.kids.peek(), l = d?.kids.peek(), h = d?.kids.peekBack();
830
- n && d ? (d.kids.enqueueFront(t), l && l.addBond(d, t)) : d && (d.kids.enqueue(t), h && t.addBond(d, h)), t.host = d;
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 d = new a({ type: "row", host: e }), l = new a({ type: "row", host: d });
833
- for (const h of e.kids)
834
- l.kids.enqueue(h), h.host = l, h.next && (h.next.host = l);
835
- t.host = d, e.kids.clear(), n ? (d.kids.enqueueFront(t), d.kids.enqueue(l), l.addBond(d, t)) : (d.kids.enqueue(l), d.kids.enqueue(t), t.addBond(d, l)), e.kids.enqueue(d);
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 c of s.kids)
843
- c.host = s, c.next && (c.next.host = s), a.cache.mapDirs.set(c.unId, r);
844
- for (const c of t.kids)
845
- c.host = t, c.next && (c.next.host = t), a.cache.mapDirs.set(c.unId, r);
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 Z(o, t) {
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), c = t.kids.peek(), d = t.kids.peekBack();
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 l = i;
944
+ let f = i;
856
945
  if (t.type == "row" && e) {
857
- s && c && c.addBond(n, s), r && d && r.addBond(n, d);
858
- for (const h of t.kids)
859
- h.host = n, h.next && (h.next.host = n), n.kids.insert(l, h), a.cache.mapDirs.set(
860
- h.unId,
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(h.unId), l++;
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(l, t), t.host = n, a.cache.mapDirs.set(t.unId, !a.cache.mapDirs.get(n.unId));
865
- for (const h of t.kids)
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
- h.unId,
956
+ d.unId,
868
957
  a.cache.mapDirs.get(n.unId)
869
- ), a.cache.dimMins.delete(h.unId);
958
+ ), a.cache.dimMins.delete(d.unId);
870
959
  }
871
960
  }
872
- function tt(o, t = !0) {
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 et(o, t) {
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 nt(o) {
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 it() {
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 u.root;
1004
+ return c.root;
916
1005
  }
917
1006
  static set _root(t) {
918
- u.root = t;
1007
+ c.root = t;
919
1008
  }
920
1009
  static get _tree() {
921
- return u.tree;
1010
+ return c.tree;
922
1011
  }
923
1012
  static set _tree(t) {
924
- u.tree = t;
1013
+ c.tree = t;
925
1014
  }
926
1015
  static get _minW() {
927
- return u.minW;
1016
+ return c.minW;
928
1017
  }
929
1018
  static set _minW(t) {
930
- u.minW = t;
1019
+ c.minW = t;
931
1020
  }
932
1021
  static get _minH() {
933
- return u.minH;
1022
+ return c.minH;
934
1023
  }
935
1024
  static set _minH(t) {
936
- u.minH = t;
1025
+ c.minH = t;
937
1026
  }
938
1027
  static get _bond() {
939
- return u.bond;
1028
+ return c.bond;
940
1029
  }
941
1030
  static set _bond(t) {
942
- u.bond = t;
1031
+ c.bond = t;
943
1032
  }
944
1033
  static get _inst() {
945
- return u.inst;
1034
+ return c.inst;
946
1035
  }
947
1036
  static set _inst(t) {
948
- u.inst = t;
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, u.createId = e.createId ?? v, u.timer = e.timer ?? T, w._tree = e.tree ?? null, w._root = new a({
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 = x(
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 b(e.tabs.length, e.tabs);
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* S(t);
1065
+ yield* W(t);
977
1066
  }
978
1067
  *NodeLayoutIterator(t) {
979
- yield* R(t);
1068
+ yield* L(t);
980
1069
  }
981
1070
  *NodeLayoutRecursiveIterator(t) {
982
- yield* H(this, t);
1071
+ yield* P(this, t);
983
1072
  }
984
1073
  updateChildDirections(t) {
985
- return q(this, t);
1074
+ return K(this, t);
986
1075
  }
987
1076
  createNodeLayout(t = w._tree) {
988
- return B(this, t);
1077
+ return U(this, t);
989
1078
  }
990
1079
  createNodeTreeFromJSONTree(t, e) {
991
- return M(this, t, e);
1080
+ return $(this, t, e);
992
1081
  }
993
1082
  createBinaryNodeTreeFromQueue(t, e = w._root) {
994
- return C(this, t, e);
1083
+ return _(this, t, e);
995
1084
  }
996
1085
  createNodeFromJSON(t) {
997
- return F(this, t);
1086
+ return Y(this, t);
998
1087
  }
999
1088
  calcTabsetCountAndMinDim(t = w._root, e = !0) {
1000
- return W(this, t, e);
1089
+ return V(this, t, e);
1001
1090
  }
1002
1091
  pruneStaleDirections() {
1003
- return L();
1092
+ return X();
1004
1093
  }
1005
1094
  calculateRootAdjustment() {
1006
- return P();
1095
+ return Z();
1007
1096
  }
1008
1097
  calcDimensions(t = w._root, e = !1) {
1009
- return z(this, t, e);
1098
+ return tt(this, t, e);
1010
1099
  }
1011
1100
  updateDimension(t, e = !1, n = 2) {
1012
- return K(this, t, e, n);
1101
+ return et(this, t, e, n);
1013
1102
  }
1014
1103
  updateSlider(t, e, n = !1, i = 2) {
1015
- return U(this, t, e, n, i);
1104
+ return nt(this, t, e, n, i);
1016
1105
  }
1017
1106
  updateSliderDimension(t, e) {
1018
- return $(this, t, e);
1107
+ return it(this, t, e);
1019
1108
  }
1020
1109
  updateTree(t, e, n) {
1021
- return _(this, t, e, n);
1110
+ return ot(this, t, e, n);
1022
1111
  }
1023
1112
  isOnlyContent(t) {
1024
- return Y(this, t);
1113
+ return st(this, t);
1025
1114
  }
1026
1115
  moveNodeAsTab(t, e, n) {
1027
- return G(this, t, e, n);
1116
+ return at(this, t, e, n);
1028
1117
  }
1029
1118
  moveRelativeToRoot(t, e, n) {
1030
- return Q(this, t, e, n);
1119
+ return dt(this, t, e, n);
1031
1120
  }
1032
1121
  moveRelativeToTabset(t, e, n) {
1033
- return j(this, t, e, n);
1122
+ return ct(this, t, e, n);
1034
1123
  }
1035
1124
  insertNode(t, e, n) {
1036
- return X(this, t, e, n);
1125
+ return ht(this, t, e, n);
1037
1126
  }
1038
1127
  insertNodeWithNewParent(t, e, n) {
1039
- return V(this, t, e, n);
1128
+ return ut(this, t, e, n);
1040
1129
  }
1041
1130
  moveAdjacentNodeToGrandParent(t) {
1042
- return Z(this, t);
1131
+ return lt(this, t);
1043
1132
  }
1044
1133
  removeRelation(t, e = !0) {
1045
- return tt(t, e);
1134
+ return ft(t, e);
1046
1135
  }
1047
1136
  removeNode(t) {
1048
- return et(this, t);
1137
+ return mt(this, t);
1049
1138
  }
1050
1139
  removeKid(t) {
1051
- return nt(t);
1140
+ return pt(t);
1052
1141
  }
1053
1142
  clearAllCache() {
1054
- return it();
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 ot = 6;
1058
- function st(o, t, e) {
1059
- const { left: n, top: i, width: s, height: r } = o, c = t - n, d = e - i;
1060
- return c < s / 3 ? { area: "left", left: n, top: i, width: s / 2, height: r } : c > 2 * s / 3 ? {
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
- } : d < r / 3 ? { area: "top", left: n, top: i, width: s, height: r / 2 } : d > 2 * r / 3 ? {
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 at(o, t) {
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 rt(o, t, e, n) {
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 = ot;
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 c = 0, d = 1 / 0, l = !1;
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 < d && (d = y, c = p, l = e < I);
1240
+ y < u && (u = y, h = p, f = e < I);
1131
1241
  });
1132
- const h = l ? c > 0 : c < t.length - 1;
1133
- t.length > 1 && h && (r = t[1].left - i.right);
1134
- const f = t[c];
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: c,
1137
- area: l ? "left" : "right",
1138
- left: l ? f.left - r + 1 : f.right + 1,
1139
- top: f.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: f.height
1251
+ height: l.height
1142
1252
  };
1143
1253
  }
1144
- function dt(o, t) {
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 ct(o, { x: t, y: e, w: n, h: i }) {
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 ht(o, t) {
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 ut(o) {
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
- O as Bond,
1365
+ A as Bond,
1249
1366
  w as DynamixLayoutCore,
1250
1367
  a as Node,
1251
- b as Queue,
1252
- A as areNodeOptionsEqual,
1368
+ g as Queue,
1369
+ C as areNodeOptionsEqual,
1253
1370
  E as areNodeOptionsMapEqual,
1254
- ut as createFrameScheduler,
1255
- x as createReactiveState,
1256
- rt as getNavbarDropPreview,
1257
- at as getRootSplitPreview,
1258
- ht as getTabBodyRect,
1259
- st as getTabsetDropPreview,
1260
- dt as isSameDropPreview,
1261
- ct as setElementRect
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
  };