@mintplayer/web-components 2.14.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/badge/src/styles/badge.styles.d.ts +2 -0
- package/chunks/install-light-styles-DbCAGFOC.mjs +209 -0
- package/chunks/mp-datatable-B7st6G-I.mjs +2238 -0
- package/chunks/{mp-datetime-picker.element-D1CiLbHm.mjs → mp-datetime-picker.element-DsWA1AFs.mjs} +2 -2
- package/chunks/{mp-timepicker.element-COZEUIoE.mjs → mp-timepicker.element-CwaAAOcm.mjs} +1 -1
- package/chunks/{mp-treeview-tkWu28iF.mjs → mp-treeview-C8iltDbq.mjs} +61 -63
- package/chunks/{overlay-controller-D6agzzOI.mjs → overlay-controller-DifgO6jT.mjs} +103 -47
- package/datatable/index.mjs +6 -5
- package/datatable/src/components/mp-datatable.d.ts +210 -2
- package/datatable/src/index.d.ts +4 -2
- package/datatable/src/styles/datatable.light.styles.d.ts +2 -0
- package/datatable/src/styles/index.d.ts +1 -1
- package/datatable/src/types/column-def.d.ts +61 -0
- package/datatable/src/types/filter.d.ts +138 -0
- package/datatable/src/types/index.d.ts +3 -2
- package/datatable/src/types/labels.d.ts +58 -0
- package/datepicker/index.mjs +1 -1
- package/datetime-picker/index.mjs +1 -1
- package/dock/index.mjs +477 -492
- package/dock/src/components/mint-dock-manager.element.d.ts +10 -8
- package/dock/src/core/index.d.ts +1 -0
- package/dock/src/core/intersection-sizing.d.ts +83 -0
- package/dock/src/core/layout-tree.d.ts +23 -2
- package/dock/src/core/types.d.ts +14 -0
- package/file-manager/index.mjs +30 -29
- package/file-manager/src/components/mp-file-manager.d.ts +2 -0
- package/light-dom/index.d.ts +1 -0
- package/light-dom/index.mjs +11 -0
- package/light-dom/src/index.d.ts +2 -0
- package/light-dom/src/install-light-styles.d.ts +25 -0
- package/light-dom/src/scoped-html.d.ts +26 -0
- package/navbar/index.mjs +1 -1
- package/overlay/index.mjs +5 -2
- package/overlay/src/index.d.ts +2 -0
- package/overlay/src/overlay-controller.d.ts +27 -0
- package/overlay/src/overlay-portal.d.ts +53 -0
- package/package.json +5 -1
- package/query-builder/index.mjs +1472 -2651
- package/query-builder/src/index.d.ts +4 -0
- package/query-builder/src/mp-query-builder.element.d.ts +1 -1
- package/query-builder/src/mp-query-builder.light.styles.d.ts +2 -0
- package/query-builder/src/mp-query-condition.element.d.ts +1 -1
- package/query-builder/src/mp-query-condition.light.styles.d.ts +2 -0
- package/query-builder/src/mp-query-group.element.d.ts +1 -1
- package/query-builder/src/mp-query-group.light.styles.d.ts +2 -0
- package/query-builder/src/mp-query-subquery.element.d.ts +1 -1
- package/query-builder/src/mp-query-subquery.light.styles.d.ts +2 -0
- package/ribbon/index.mjs +1 -1
- package/scheduler/index.mjs +2 -2
- package/timepicker/index.mjs +1 -1
- package/tree-select/index.mjs +60 -58
- package/tree-select/src/components/mp-tree-select.d.ts +1 -1
- package/tree-select/src/index.d.ts +1 -1
- package/tree-select/src/styles/index.d.ts +1 -1
- package/tree-select/src/styles/tree-select.light.styles.d.ts +2 -0
- package/treeview/index.mjs +3 -3
- package/treeview/src/components/mp-treeview.d.ts +1 -1
- package/treeview/src/index.d.ts +1 -1
- package/treeview/src/styles/index.d.ts +1 -1
- package/treeview/src/styles/treeview.light.styles.d.ts +2 -0
- package/chunks/mp-datatable-GmKqaN8y.mjs +0 -1392
- package/datatable/src/styles/datatable.styles.d.ts +0 -2
package/dock/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { html as
|
|
1
|
+
import { html as U, unsafeCSS as Q, LitElement as tt } from "lit";
|
|
2
2
|
import "../chunks/mp-tab-page-CaCzX1ym.mjs";
|
|
3
3
|
import "../chunks/mp-splitter-Ckn1kN4v.mjs";
|
|
4
|
-
import { L as
|
|
5
|
-
import { F as
|
|
6
|
-
const
|
|
4
|
+
import { L as et } from "../chunks/live-announcer-Bi0orG4n.mjs";
|
|
5
|
+
import { F as it } from "../chunks/focus-restore-DxuP1Oe2.mjs";
|
|
6
|
+
const nt = U`<div class="dock-root">
|
|
7
7
|
<div class="dock-docked"></div>
|
|
8
8
|
<div class="dock-floating-layer"></div>
|
|
9
9
|
<div class="dock-intersections-layer dock-intersection-layer"></div>
|
|
@@ -54,7 +54,7 @@ const tt = W`<div class="dock-root">
|
|
|
54
54
|
↓
|
|
55
55
|
</button>
|
|
56
56
|
<div class="dock-drop-joystick__spacer"></div>
|
|
57
|
-
</div>`,
|
|
57
|
+
</div>`, ot = Q(`:host {
|
|
58
58
|
display: block;
|
|
59
59
|
position: relative;
|
|
60
60
|
width: 100%;
|
|
@@ -288,19 +288,6 @@ const tt = W`<div class="dock-root">
|
|
|
288
288
|
outline-offset: 1px;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
.dock-snap-marker {
|
|
292
|
-
position: absolute;
|
|
293
|
-
width: 6px;
|
|
294
|
-
height: 6px;
|
|
295
|
-
margin-left: -3px;
|
|
296
|
-
margin-top: -3px;
|
|
297
|
-
border-radius: 50%;
|
|
298
|
-
background: var(--bs-primary);
|
|
299
|
-
box-shadow: 0 0 0 2px var(--bs-primary-bg-subtle);
|
|
300
|
-
pointer-events: none;
|
|
301
|
-
z-index: 130;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
291
|
.dock-stack {
|
|
305
292
|
flex: 1 1 0;
|
|
306
293
|
border: 1px solid var(--bs-border-color);
|
|
@@ -427,43 +414,103 @@ const tt = W`<div class="dock-root">
|
|
|
427
414
|
animation: none !important;
|
|
428
415
|
}
|
|
429
416
|
}`);
|
|
430
|
-
function R(
|
|
431
|
-
if (t.width <= 0 || t.height <= 0) return
|
|
432
|
-
const e = Math.min(
|
|
417
|
+
function R(s, t) {
|
|
418
|
+
if (t.width <= 0 || t.height <= 0) return s;
|
|
419
|
+
const e = Math.min(s.width, t.width), i = Math.min(s.height, t.height), n = Math.min(Math.max(s.left, 0), t.width - e), o = Math.min(Math.max(s.top, 0), t.height - i);
|
|
433
420
|
return { left: n, top: o, width: e, height: i };
|
|
434
421
|
}
|
|
435
|
-
function
|
|
436
|
-
return t >=
|
|
422
|
+
function j(s, t, e) {
|
|
423
|
+
return t >= s.left && t <= s.right && e >= s.top && e <= s.bottom;
|
|
437
424
|
}
|
|
438
|
-
function
|
|
439
|
-
return
|
|
425
|
+
function H(s, t) {
|
|
426
|
+
return s && typeof s.zIndex == "number" && Number.isFinite(s.zIndex) ? s.zIndex : 10 + t;
|
|
440
427
|
}
|
|
441
|
-
function x(
|
|
428
|
+
function x(s, t) {
|
|
442
429
|
if (t <= 0)
|
|
443
430
|
return [];
|
|
444
|
-
if (!Array.isArray(
|
|
431
|
+
if (!Array.isArray(s) || s.length !== t)
|
|
445
432
|
return Array.from({ length: t }, () => 1 / t);
|
|
446
|
-
const e =
|
|
433
|
+
const e = s.map((n) => Number.isFinite(n) ? Math.max(n, 0) : 0), i = e.reduce((n, o) => n + o, 0);
|
|
447
434
|
return i <= 0 ? Array.from({ length: t }, () => 1 / t) : e.map((n) => n / i);
|
|
448
435
|
}
|
|
449
|
-
function
|
|
450
|
-
|
|
436
|
+
function rt(s) {
|
|
437
|
+
s.sizes = x(s.sizes, s.children.length);
|
|
451
438
|
}
|
|
452
|
-
function
|
|
453
|
-
const i = e - 1, n = x(
|
|
454
|
-
for (let
|
|
455
|
-
if (
|
|
439
|
+
function st(s, t, e) {
|
|
440
|
+
const i = e - 1, n = x(s, i), o = 1 / e, r = 1 - o, d = [];
|
|
441
|
+
for (let a = 0; a < e; a += 1)
|
|
442
|
+
if (a === t)
|
|
456
443
|
d.push(o);
|
|
457
444
|
else {
|
|
458
|
-
const c =
|
|
445
|
+
const c = a < t ? a : a - 1;
|
|
459
446
|
d.push(n[c] * r);
|
|
460
447
|
}
|
|
461
448
|
return d;
|
|
462
449
|
}
|
|
463
|
-
function
|
|
464
|
-
|
|
450
|
+
function at(s, t) {
|
|
451
|
+
let e = [];
|
|
452
|
+
if (s)
|
|
453
|
+
try {
|
|
454
|
+
const l = JSON.parse(s);
|
|
455
|
+
Array.isArray(l) && (e = l);
|
|
456
|
+
} catch {
|
|
457
|
+
e = [];
|
|
458
|
+
}
|
|
459
|
+
if (e.length > 0) return e;
|
|
460
|
+
const i = (t ?? "").split("|");
|
|
461
|
+
if (i.length !== 2) return [];
|
|
462
|
+
const [n, o] = i, r = n.lastIndexOf(":"), d = o.lastIndexOf(":");
|
|
463
|
+
if (r <= 0 || d <= 0) return [];
|
|
464
|
+
const a = Number.parseInt(n.slice(r + 1), 10), c = Number.parseInt(o.slice(d + 1), 10);
|
|
465
|
+
return [
|
|
466
|
+
{
|
|
467
|
+
h: { pathStr: n.slice(0, r), index: a },
|
|
468
|
+
v: { pathStr: o.slice(0, d), index: c }
|
|
469
|
+
}
|
|
470
|
+
];
|
|
471
|
+
}
|
|
472
|
+
function lt(s, t) {
|
|
473
|
+
const e = [...s], i = (e[t] ?? 0) + (e[t + 1] ?? 0);
|
|
474
|
+
if (i <= 0) return e;
|
|
475
|
+
e[t] = i / 2, e[t + 1] = i / 2;
|
|
476
|
+
const n = e.reduce((o, r) => o + r, 0);
|
|
477
|
+
return n > 0 ? e.map((o) => o / n) : e;
|
|
478
|
+
}
|
|
479
|
+
function ct(s, t, e) {
|
|
480
|
+
const i = { writes: [], remember: [], clearStored: !1 };
|
|
481
|
+
if (s.length === 0) return i;
|
|
482
|
+
const n = /* @__PURE__ */ new Set();
|
|
483
|
+
if (s.forEach((c) => {
|
|
484
|
+
n.add(c.h.pathStr), n.add(c.v.pathStr);
|
|
485
|
+
}), [...n].some((c) => t.has(c)))
|
|
486
|
+
return t.forEach((c, l) => {
|
|
487
|
+
const h = e(l);
|
|
488
|
+
h && i.writes.push({ pathStr: l, sizes: x(c, h.childCount) });
|
|
489
|
+
}), i.clearStored = !0, i;
|
|
490
|
+
const r = /* @__PURE__ */ new Map(), d = (c) => {
|
|
491
|
+
const l = e(c);
|
|
492
|
+
if (!l) return null;
|
|
493
|
+
const h = r.get(c);
|
|
494
|
+
return { childCount: l.childCount, sizes: h ?? l.sizes };
|
|
495
|
+
}, a = /* @__PURE__ */ new Set();
|
|
496
|
+
return s.forEach((c) => {
|
|
497
|
+
[c.h.pathStr, c.v.pathStr].forEach((l) => {
|
|
498
|
+
if (a.has(l)) return;
|
|
499
|
+
a.add(l);
|
|
500
|
+
const h = e(l);
|
|
501
|
+
h && Array.isArray(h.sizes) && i.remember.push({ pathStr: l, sizes: [...h.sizes] });
|
|
502
|
+
}), [c.h, c.v].forEach(({ pathStr: l, index: h }) => {
|
|
503
|
+
const u = d(l);
|
|
504
|
+
if (!u) return;
|
|
505
|
+
const f = x(u.sizes ?? [], u.childCount), p = lt(f, h);
|
|
506
|
+
r.set(l, p), i.writes.push({ pathStr: l, sizes: p });
|
|
507
|
+
});
|
|
508
|
+
}), i;
|
|
509
|
+
}
|
|
510
|
+
function M(s, t) {
|
|
511
|
+
if (!s)
|
|
465
512
|
return null;
|
|
466
|
-
let e =
|
|
513
|
+
let e = s;
|
|
467
514
|
if (t.length === 0)
|
|
468
515
|
return e;
|
|
469
516
|
for (const i of t) {
|
|
@@ -473,72 +520,72 @@ function T(a, t) {
|
|
|
473
520
|
}
|
|
474
521
|
return e;
|
|
475
522
|
}
|
|
476
|
-
function
|
|
477
|
-
if (!
|
|
523
|
+
function X(s, t) {
|
|
524
|
+
if (!s || s === t || s.kind !== "split")
|
|
478
525
|
return null;
|
|
479
|
-
const e =
|
|
526
|
+
const e = s.children.indexOf(t);
|
|
480
527
|
if (e !== -1)
|
|
481
|
-
return { parent:
|
|
482
|
-
for (let i = 0; i <
|
|
483
|
-
const n =
|
|
528
|
+
return { parent: s, index: e };
|
|
529
|
+
for (let i = 0; i < s.children.length; i += 1) {
|
|
530
|
+
const n = X(s.children[i], t);
|
|
484
531
|
if (n)
|
|
485
532
|
return n;
|
|
486
533
|
}
|
|
487
534
|
return null;
|
|
488
535
|
}
|
|
489
|
-
function
|
|
490
|
-
if (!
|
|
536
|
+
function dt(s, t, e) {
|
|
537
|
+
if (!s || s === t)
|
|
491
538
|
return e;
|
|
492
|
-
const i =
|
|
493
|
-
return i && (i.parent.children[i.index] = e,
|
|
539
|
+
const i = X(s, t);
|
|
540
|
+
return i && (i.parent.children[i.index] = e, rt(i.parent)), s;
|
|
494
541
|
}
|
|
495
|
-
function
|
|
496
|
-
const n = i === "left" || i === "right" ? "horizontal" : "vertical", o = i === "left" || i === "top", r =
|
|
542
|
+
function _(s, t, e, i) {
|
|
543
|
+
const n = i === "left" || i === "right" ? "horizontal" : "vertical", o = i === "left" || i === "top", r = X(s, t);
|
|
497
544
|
if (r && r.parent.direction === n) {
|
|
498
|
-
const
|
|
499
|
-
return r.parent.children.splice(
|
|
545
|
+
const a = o ? r.index : r.index + 1;
|
|
546
|
+
return r.parent.children.splice(a, 0, e), r.parent.sizes = st(
|
|
500
547
|
r.parent.sizes,
|
|
501
|
-
|
|
548
|
+
a,
|
|
502
549
|
r.parent.children.length
|
|
503
|
-
),
|
|
550
|
+
), s ?? e;
|
|
504
551
|
}
|
|
505
|
-
return
|
|
552
|
+
return dt(s, t, {
|
|
506
553
|
kind: "split",
|
|
507
554
|
direction: n,
|
|
508
555
|
children: o ? [e, t] : [t, e],
|
|
509
556
|
sizes: [0.5, 0.5]
|
|
510
557
|
});
|
|
511
558
|
}
|
|
512
|
-
function
|
|
513
|
-
if (
|
|
514
|
-
if (
|
|
515
|
-
t(
|
|
559
|
+
function N(s, t, e = []) {
|
|
560
|
+
if (s) {
|
|
561
|
+
if (s.kind === "stack") {
|
|
562
|
+
t(s, e);
|
|
516
563
|
return;
|
|
517
564
|
}
|
|
518
|
-
|
|
565
|
+
s.children.forEach((i, n) => N(i, t, [...e, n]));
|
|
519
566
|
}
|
|
520
567
|
}
|
|
521
|
-
function E(
|
|
568
|
+
function E(s) {
|
|
522
569
|
let t = null;
|
|
523
|
-
return
|
|
570
|
+
return N(s, (e) => {
|
|
524
571
|
t || e.panes.length === 0 || (e.activePane && e.panes.includes(e.activePane) ? t = e.activePane : t = e.panes[0]);
|
|
525
572
|
}), t;
|
|
526
573
|
}
|
|
527
|
-
function I(
|
|
574
|
+
function I(s) {
|
|
528
575
|
const t = [];
|
|
529
|
-
return
|
|
576
|
+
return N(s, (e) => {
|
|
530
577
|
e.panes.forEach((i) => t.push(i));
|
|
531
578
|
}), t;
|
|
532
579
|
}
|
|
533
|
-
function
|
|
534
|
-
return
|
|
580
|
+
function ht(s, t) {
|
|
581
|
+
return s.panes = s.panes.filter((e) => e !== t), s.panes.includes(s.activePane ?? "") || (s.panes.length > 0 ? s.activePane = s.panes[0] : delete s.activePane), s.panes.length === 0;
|
|
535
582
|
}
|
|
536
|
-
function
|
|
537
|
-
if (!
|
|
538
|
-
if (
|
|
539
|
-
return
|
|
540
|
-
const t = x(
|
|
541
|
-
if (i.kind === "split" && i.direction ===
|
|
583
|
+
function $(s) {
|
|
584
|
+
if (!s) return null;
|
|
585
|
+
if (s.kind === "stack")
|
|
586
|
+
return s.panes.length === 0 ? null : ((!s.activePane || !s.panes.includes(s.activePane)) && (s.activePane = s.panes[0]), s);
|
|
587
|
+
const t = x(s.sizes, s.children.length), e = s.children.map((i, n) => ({ child: $(i), slot: t[n] })).filter((i) => i.child !== null).flatMap(({ child: i, slot: n }) => {
|
|
588
|
+
if (i.kind === "split" && i.direction === s.direction) {
|
|
542
589
|
const o = x(i.sizes, i.children.length);
|
|
543
590
|
return i.children.map((r, d) => ({
|
|
544
591
|
child: r,
|
|
@@ -547,27 +594,52 @@ function H(a) {
|
|
|
547
594
|
}
|
|
548
595
|
return [{ child: i, slot: n }];
|
|
549
596
|
});
|
|
550
|
-
return e.length === 0 ? null : e.length === 1 ? e[0].child : (
|
|
597
|
+
return e.length === 0 ? null : e.length === 1 ? e[0].child : (s.children = e.map((i) => i.child), s.sizes = x(
|
|
551
598
|
e.map((i) => i.slot),
|
|
552
599
|
e.length
|
|
553
|
-
),
|
|
600
|
+
), s);
|
|
554
601
|
}
|
|
555
|
-
function
|
|
556
|
-
return
|
|
602
|
+
function F(s) {
|
|
603
|
+
return s ? JSON.parse(JSON.stringify(s)) : null;
|
|
557
604
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
return t > 0 ? Math.min(a, t) : a;
|
|
605
|
+
function J(s) {
|
|
606
|
+
return s ? s.kind === "stack" ? s.panes.length : s.children.reduce((t, e) => t + J(e), 0) : 0;
|
|
561
607
|
}
|
|
562
|
-
function
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
|
|
608
|
+
function A(s, t, e) {
|
|
609
|
+
const i = s.type === "docked" ? t : e[s.index]?.root ?? null;
|
|
610
|
+
if (!i)
|
|
611
|
+
return null;
|
|
612
|
+
const n = M(i, s.segments);
|
|
613
|
+
return n && n.kind === "split" ? n : null;
|
|
614
|
+
}
|
|
615
|
+
function ut(s) {
|
|
616
|
+
const t = s.bounds ?? { left: 0, top: 0, width: 320, height: 200 };
|
|
617
|
+
return {
|
|
618
|
+
id: s.id,
|
|
619
|
+
bounds: {
|
|
620
|
+
left: Number.isFinite(t.left) ? t.left : 0,
|
|
621
|
+
top: Number.isFinite(t.top) ? t.top : 0,
|
|
622
|
+
width: Number.isFinite(t.width) ? Math.max(t.width, 160) : 320,
|
|
623
|
+
height: Number.isFinite(t.height) ? Math.max(t.height, 120) : 200
|
|
624
|
+
},
|
|
625
|
+
zIndex: s.zIndex,
|
|
626
|
+
root: s.root ? F(s.root) : null,
|
|
627
|
+
activePane: s.activePane
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
const pt = 192, gt = 128;
|
|
631
|
+
function W(s, t) {
|
|
632
|
+
return t > 0 ? Math.min(s, t) : s;
|
|
633
|
+
}
|
|
634
|
+
function Z(s, t, e, i) {
|
|
635
|
+
const n = W(pt, i.width), o = W(gt, i.height);
|
|
636
|
+
let r = s.width, d = s.height, a = s.left, c = s.top;
|
|
637
|
+
return t.horizontal === "right" ? (r = Math.max(n, s.width + e.x), i.width > 0 && (r = Math.min(r, i.width - s.left))) : t.horizontal === "left" && (r = Math.max(n, s.width - e.x), r = Math.min(r, s.left + s.width), a = s.left + s.width - r), t.vertical === "bottom" ? (d = Math.max(o, s.height + e.y), i.height > 0 && (d = Math.min(d, i.height - s.top))) : t.vertical === "top" && (d = Math.max(o, s.height - e.y), d = Math.min(d, s.top + s.height), c = s.top + s.height - d), { left: a, top: c, width: r, height: d };
|
|
566
638
|
}
|
|
567
639
|
const C = [1 / 3, 1 / 2, 2 / 3];
|
|
568
|
-
function
|
|
569
|
-
if (t <= 0) return
|
|
570
|
-
const e =
|
|
640
|
+
function ft(s, t) {
|
|
641
|
+
if (t <= 0) return s;
|
|
642
|
+
const e = s / t;
|
|
571
643
|
let i = C[0], n = Math.abs(e - i);
|
|
572
644
|
for (let o = 1; o < C.length; o += 1) {
|
|
573
645
|
const r = Math.abs(e - C[o]);
|
|
@@ -575,67 +647,73 @@ function lt(a, t) {
|
|
|
575
647
|
}
|
|
576
648
|
return i * t;
|
|
577
649
|
}
|
|
578
|
-
function
|
|
579
|
-
let i =
|
|
650
|
+
function q(s, t, e) {
|
|
651
|
+
let i = s, n = e + 1;
|
|
580
652
|
for (const o of t) {
|
|
581
|
-
const r = Math.abs(o -
|
|
653
|
+
const r = Math.abs(o - s);
|
|
582
654
|
r < n && (n = r, i = o);
|
|
583
655
|
}
|
|
584
|
-
return n <= e ? i :
|
|
656
|
+
return n <= e ? i : s;
|
|
585
657
|
}
|
|
586
|
-
function
|
|
587
|
-
const o =
|
|
588
|
-
let r = Math.min(Math.max(
|
|
589
|
-
return n && (r =
|
|
658
|
+
function mt(s, t, e, i, n = !1) {
|
|
659
|
+
const o = s + t;
|
|
660
|
+
let r = Math.min(Math.max(s + e, i), o - i);
|
|
661
|
+
return n && (r = ft(r, o)), { before: r, after: o - r };
|
|
590
662
|
}
|
|
591
|
-
function
|
|
592
|
-
for (let n = 0; n <
|
|
593
|
-
const r = (e !== null ?
|
|
663
|
+
function yt(s, t, e, i = 12) {
|
|
664
|
+
for (let n = 0; n < s.length; n += 1) {
|
|
665
|
+
const r = (e !== null ? s[n] >= e : !1) ? s[n] + i : s[n];
|
|
594
666
|
if (t < r)
|
|
595
667
|
return n;
|
|
596
668
|
}
|
|
597
|
-
return
|
|
669
|
+
return s.length;
|
|
598
670
|
}
|
|
599
|
-
function w(
|
|
600
|
-
if (
|
|
601
|
-
const e =
|
|
602
|
-
return `f:${
|
|
671
|
+
function w(s) {
|
|
672
|
+
if (s.type === "floating") {
|
|
673
|
+
const e = s.segments.length > 0 ? `/${s.segments.map((i) => i.toString()).join("/")}` : "";
|
|
674
|
+
return `f:${s.index}${e}`;
|
|
603
675
|
}
|
|
604
|
-
const t =
|
|
676
|
+
const t = s.segments.join("/");
|
|
605
677
|
return t.length > 0 ? `d:${t}` : "d:";
|
|
606
678
|
}
|
|
607
|
-
function S(
|
|
608
|
-
if (
|
|
679
|
+
function S(s) {
|
|
680
|
+
if (s == null)
|
|
609
681
|
return null;
|
|
610
|
-
if (
|
|
611
|
-
const i =
|
|
682
|
+
if (s.startsWith("f:")) {
|
|
683
|
+
const i = s.slice(2), [n, ...o] = i.split("/"), r = Number.parseInt(n, 10);
|
|
612
684
|
if (!Number.isFinite(r))
|
|
613
685
|
return null;
|
|
614
|
-
const d = o.filter((
|
|
686
|
+
const d = o.filter((a) => a.length > 0).map((a) => Number.parseInt(a, 10)).filter((a) => Number.isFinite(a));
|
|
615
687
|
return { type: "floating", index: r, segments: d };
|
|
616
688
|
}
|
|
617
|
-
const t =
|
|
689
|
+
const t = s.startsWith("d:") ? s.slice(2) : s;
|
|
618
690
|
return t.length === 0 ? { type: "docked", segments: [] } : { type: "docked", segments: t.split("/").filter((i) => i.length > 0).map((i) => Number.parseInt(i, 10)).filter((i) => Number.isFinite(i)) };
|
|
619
691
|
}
|
|
620
|
-
function
|
|
621
|
-
if (
|
|
692
|
+
function B(s, t) {
|
|
693
|
+
if (s.type !== t.type)
|
|
622
694
|
return !1;
|
|
623
|
-
if (
|
|
695
|
+
if (s.type === "floating") {
|
|
624
696
|
const i = t;
|
|
625
|
-
return
|
|
697
|
+
return s.index !== i.index || s.segments.length !== i.segments.length ? !1 : s.segments.every((n, o) => n === i.segments[o]);
|
|
626
698
|
}
|
|
627
699
|
const e = t;
|
|
628
|
-
return
|
|
700
|
+
return s.segments.length !== e.segments.length ? !1 : s.segments.every((i, n) => i === e.segments[n]);
|
|
701
|
+
}
|
|
702
|
+
function T(s) {
|
|
703
|
+
return s.type === "floating" ? { type: "floating", index: s.index, segments: [...s.segments] } : { type: "docked", segments: [...s.segments] };
|
|
704
|
+
}
|
|
705
|
+
function bt(s, t) {
|
|
706
|
+
return s.type !== t.type || s.type === "floating" && t.index !== s.index || s.segments.length > t.segments.length ? !1 : s.segments.every((e, i) => e === t.segments[i]);
|
|
629
707
|
}
|
|
630
|
-
class L extends
|
|
708
|
+
class L extends tt {
|
|
631
709
|
constructor() {
|
|
632
|
-
super(), this.liveAnnouncer = new
|
|
710
|
+
super(), this.liveAnnouncer = new et(this), this.paneMoveMode = null, this.paneMoveCandidateIndex = null, this.dropJoystickTarget = null, this.rootLayout = null, this.floatingLayouts = [], this.titles = {}, this.pendingTabDragMetrics = null, this.dragState = null, this.floatingDragState = null, this.floatingResizeState = null, this.intersectionRaf = null, this.rootResizeObserver = null, this.dockedMutationObserver = null, this.cornerResizeState = null, this.pointerTrackingActive = !1, this.dragPointerTrackingActive = !1, this.lastDragPointerPosition = null, this.cornerSnapXTargets = [], this.cornerSnapYTargets = [], this.debugLayoutIntegrity = !1, this.pendingDragEndTimeout = null, this.previousSplitSizes = /* @__PURE__ */ new Map(), this.layoutFocusRestore = new it(() => this.shadowRoot, {
|
|
633
711
|
selector: ".dock-intersection-handle[data-key], mp-tab-control, .dock-tab[data-tab-id]",
|
|
634
712
|
keyOf: (t) => t.dataset.key ?? t.dataset.tabId ?? (t.id || null)
|
|
635
713
|
}), this.instanceId = `mint-dock-${++L.instanceCounter}`, this.windowRef = typeof window < "u" ? window : null, this.onPointerMove = this.onPointerMove.bind(this), this.onPointerUp = this.onPointerUp.bind(this), this.onPointerCancel = this.onPointerCancel.bind(this), this.onDragPointerMove = this.onDragPointerMove.bind(this), this.onDragPointerUp = this.onDragPointerUp.bind(this), this.onDragPointerCancel = this.onDragPointerCancel.bind(this), this.onSplitterResize = this.onSplitterResize.bind(this);
|
|
636
714
|
}
|
|
637
715
|
static {
|
|
638
|
-
this.styles = [
|
|
716
|
+
this.styles = [ot];
|
|
639
717
|
}
|
|
640
718
|
static {
|
|
641
719
|
this.documentRef = typeof document < "u" ? document : null;
|
|
@@ -661,36 +739,8 @@ class L extends G {
|
|
|
661
739
|
static {
|
|
662
740
|
this.PANE_MOVE_ZONE_ORDER = ["top", "right", "bottom", "left"];
|
|
663
741
|
}
|
|
664
|
-
renderSnapMarkersForCorner() {
|
|
665
|
-
if (!this.showSnapMarkers) return;
|
|
666
|
-
const t = this.shadowRoot?.querySelector(".dock-intersections-layer, .dock-intersection-layer");
|
|
667
|
-
if (!t || (Array.from(t.querySelectorAll(".dock-snap-marker")).forEach((r) => r.remove()), !this.cornerResizeState)) return;
|
|
668
|
-
const e = this.rootEl.getBoundingClientRect();
|
|
669
|
-
let i = null, n = null;
|
|
670
|
-
const o = this.cornerResizeState;
|
|
671
|
-
if (o.vs.length > 0) {
|
|
672
|
-
const r = o.vs[0], s = this.getSplitterDividers(r.container)[r.index]?.getBoundingClientRect();
|
|
673
|
-
s && (i = s.left + s.width / 2 - e.left);
|
|
674
|
-
}
|
|
675
|
-
if (o.hs.length > 0) {
|
|
676
|
-
const r = o.hs[0], s = this.getSplitterDividers(r.container)[r.index]?.getBoundingClientRect();
|
|
677
|
-
s && (n = s.top + s.height / 2 - e.top);
|
|
678
|
-
}
|
|
679
|
-
n != null && this.cornerSnapXTargets.forEach((r) => {
|
|
680
|
-
const d = this.documentRef.createElement("div");
|
|
681
|
-
d.className = "dock-snap-marker", d.style.left = `${r}px`, d.style.top = `${n}px`, t.appendChild(d);
|
|
682
|
-
}), i != null && this.cornerSnapYTargets.forEach((r) => {
|
|
683
|
-
const d = this.documentRef.createElement("div");
|
|
684
|
-
d.className = "dock-snap-marker", d.style.left = `${i}px`, d.style.top = `${r}px`, t.appendChild(d);
|
|
685
|
-
});
|
|
686
|
-
}
|
|
687
|
-
clearSnapMarkers() {
|
|
688
|
-
if (!this.showSnapMarkers) return;
|
|
689
|
-
const t = this.shadowRoot?.querySelector(".dock-intersections-layer, .dock-intersection-layer");
|
|
690
|
-
t && Array.from(t.querySelectorAll(".dock-snap-marker")).forEach((e) => e.remove());
|
|
691
|
-
}
|
|
692
742
|
render() {
|
|
693
|
-
return
|
|
743
|
+
return U`${nt}${this.liveAnnouncer.template()}`;
|
|
694
744
|
}
|
|
695
745
|
firstUpdated() {
|
|
696
746
|
const t = this.resolveDocument();
|
|
@@ -710,12 +760,12 @@ class L extends G {
|
|
|
710
760
|
const d = e.querySelector(".dock-drop-joystick");
|
|
711
761
|
if (!d)
|
|
712
762
|
throw new Error("mint-dock-manager template is missing the drop joystick element.");
|
|
713
|
-
const
|
|
763
|
+
const a = Array.from(
|
|
714
764
|
d.querySelectorAll(".dock-drop-joystick__button[data-zone]")
|
|
715
765
|
);
|
|
716
|
-
if (
|
|
766
|
+
if (a.length === 0)
|
|
717
767
|
throw new Error("mint-dock-manager template is missing drop joystick buttons.");
|
|
718
|
-
this.rootEl = i, this.dockedEl = n, this.floatingLayerEl = o, this.dropIndicator = r, this.dropJoystick = d, this.dropJoystickButtons =
|
|
768
|
+
this.rootEl = i, this.dockedEl = n, this.floatingLayerEl = o, this.dropIndicator = r, this.dropJoystick = d, this.dropJoystickButtons = a, this.dockedEl.dataset.path = w({ type: "docked", segments: [] }), i.addEventListener("keydown", (c) => this.onRootKeyDown(c), { capture: !0 }), i.addEventListener("focusout", (c) => this.onRootFocusOut(c)), this.renderLayout(), this.rootResizeObserver = new ResizeObserver(() => {
|
|
719
769
|
this.scheduleRenderIntersectionHandles(), this.updateFloatingPanePositions();
|
|
720
770
|
}), this.rootResizeObserver.observe(this.rootEl), this.dockedMutationObserver = new MutationObserver(() => this.scheduleRenderIntersectionHandles()), this.dockedMutationObserver.observe(this.dockedEl, { childList: !0, subtree: !0 }), this.dockedEl.addEventListener("resizing", this.onSplitterResize), this.dockedEl.addEventListener("resize-end", this.onSplitterResize);
|
|
721
771
|
}
|
|
@@ -727,11 +777,11 @@ class L extends G {
|
|
|
727
777
|
this.stopDragPointerTracking(), t?.removeEventListener("pointermove", this.onPointerMove), t?.removeEventListener("pointerup", this.onPointerUp), t?.removeEventListener("pointercancel", this.onPointerCancel), this.pointerTrackingActive = !1, this.rootResizeObserver?.disconnect(), this.rootResizeObserver = null, this.dockedMutationObserver?.disconnect(), this.dockedMutationObserver = null, this.dockedEl?.removeEventListener("resizing", this.onSplitterResize), this.dockedEl?.removeEventListener("resize-end", this.onSplitterResize), this.intersectionRaf !== null && (this.windowRef?.clearTimeout(this.intersectionRaf), this.intersectionRaf = null), super.disconnectedCallback();
|
|
728
778
|
}
|
|
729
779
|
attributeChangedCallback(t, e, i) {
|
|
730
|
-
super.attributeChangedCallback(t, e, i), t === "layout" ? this.layout = i ? this.parseLayout(i) : null : t === "debug-
|
|
780
|
+
super.attributeChangedCallback(t, e, i), t === "layout" ? this.layout = i ? this.parseLayout(i) : null : t === "debug-layout-integrity" && (this.debugLayoutIntegrity = !(i === null || i === "false" || i === "0"));
|
|
731
781
|
}
|
|
732
782
|
get layout() {
|
|
733
783
|
return {
|
|
734
|
-
root:
|
|
784
|
+
root: F(this.rootLayout),
|
|
735
785
|
floating: this.cloneFloatingArray(this.floatingLayouts),
|
|
736
786
|
titles: { ...this.titles }
|
|
737
787
|
};
|
|
@@ -744,7 +794,7 @@ class L extends G {
|
|
|
744
794
|
floating: this.floatingLayouts,
|
|
745
795
|
titles: this.titles
|
|
746
796
|
}), n = JSON.stringify(e);
|
|
747
|
-
i !== n && (this.rootLayout =
|
|
797
|
+
i !== n && (this.rootLayout = F(e.root), this.floatingLayouts = this.cloneFloatingArray(e.floating), this.titles = e.titles ? { ...e.titles } : {}, this.normalizeAllLayouts(), this.renderLayout());
|
|
748
798
|
}
|
|
749
799
|
/**
|
|
750
800
|
* True while the user is actively interacting with the dock — pane drag,
|
|
@@ -786,7 +836,7 @@ class L extends G {
|
|
|
786
836
|
const e = t;
|
|
787
837
|
return {
|
|
788
838
|
root: e.root ?? null,
|
|
789
|
-
floating: Array.isArray(e.floating) ? e.floating.map((i) =>
|
|
839
|
+
floating: Array.isArray(e.floating) ? e.floating.map((i) => ut(i)) : [],
|
|
790
840
|
titles: e.titles ? { ...e.titles } : {}
|
|
791
841
|
};
|
|
792
842
|
}
|
|
@@ -814,32 +864,32 @@ class L extends G {
|
|
|
814
864
|
});
|
|
815
865
|
const o = this.getFloatingWindowTitle(e), r = `${this.instanceId}-floating-${i}-title`;
|
|
816
866
|
n.setAttribute("role", "dialog"), n.setAttribute("aria-labelledby", r), n.setAttribute("aria-modal", "false");
|
|
817
|
-
const { left: d, top:
|
|
818
|
-
n.style.left = `${d}px`, n.style.top = `${
|
|
819
|
-
const
|
|
820
|
-
n.style.zIndex = String(
|
|
821
|
-
const
|
|
822
|
-
|
|
867
|
+
const { left: d, top: a, width: c, height: l } = R(e.bounds, t);
|
|
868
|
+
n.style.left = `${d}px`, n.style.top = `${a}px`, n.style.width = `${c}px`, n.style.height = `${l}px`, n.style.minWidth = "0", n.style.minHeight = "0";
|
|
869
|
+
const h = H(this.floatingLayouts[i], i);
|
|
870
|
+
n.style.zIndex = String(h);
|
|
871
|
+
const u = this.documentRef.createElement("div");
|
|
872
|
+
u.classList.add("dock-floating__chrome"), u.addEventListener(
|
|
823
873
|
"pointerdown",
|
|
824
|
-
(
|
|
874
|
+
(g) => this.beginFloatingDrag(g, i, n, u)
|
|
825
875
|
);
|
|
826
|
-
const
|
|
827
|
-
|
|
828
|
-
const
|
|
829
|
-
if (
|
|
830
|
-
|
|
831
|
-
}),
|
|
832
|
-
const
|
|
833
|
-
|
|
876
|
+
const f = this.documentRef.createElement("div");
|
|
877
|
+
f.classList.add("dock-floating__title"), f.id = r, f.textContent = o, u.appendChild(f);
|
|
878
|
+
const p = this.documentRef.createElement("button");
|
|
879
|
+
if (p.type = "button", p.classList.add("dock-floating__close"), p.setAttribute("aria-label", `Close pane: ${o}`), p.textContent = "×", p.addEventListener("click", (g) => {
|
|
880
|
+
g.stopPropagation(), this.closeFloatingPane(i);
|
|
881
|
+
}), p.addEventListener("pointerdown", (g) => g.stopPropagation()), u.appendChild(p), n.appendChild(u), e.root) {
|
|
882
|
+
const g = this.renderNode(e.root, [], i);
|
|
883
|
+
g.classList.add("dock-floating__stack"), n.appendChild(g);
|
|
834
884
|
} else {
|
|
835
|
-
const
|
|
836
|
-
|
|
885
|
+
const g = this.documentRef.createElement("div");
|
|
886
|
+
g.classList.add("dock-stack"), g.dataset.path = w({
|
|
837
887
|
type: "floating",
|
|
838
888
|
index: i,
|
|
839
889
|
segments: []
|
|
840
890
|
});
|
|
841
891
|
const y = this.documentRef.createElement("div");
|
|
842
|
-
y.classList.add("dock-stack__pane"), y.textContent = "No panes configured",
|
|
892
|
+
y.classList.add("dock-stack__pane"), y.textContent = "No panes configured", g.appendChild(y), n.appendChild(g);
|
|
843
893
|
}
|
|
844
894
|
[
|
|
845
895
|
{
|
|
@@ -874,9 +924,9 @@ class L extends G {
|
|
|
874
924
|
classes: ["dock-floating__resizer", "dock-floating__resizer--left"],
|
|
875
925
|
edges: { horizontal: "left", vertical: "none" }
|
|
876
926
|
}
|
|
877
|
-
].forEach(({ classes:
|
|
927
|
+
].forEach(({ classes: g, edges: y }) => {
|
|
878
928
|
const b = this.documentRef.createElement("div");
|
|
879
|
-
b.classList.add(...
|
|
929
|
+
b.classList.add(...g), b.setAttribute("role", "separator");
|
|
880
930
|
const k = y.horizontal === "none" && y.vertical !== "none", D = y.vertical === "none" && y.horizontal !== "none";
|
|
881
931
|
k ? b.setAttribute("aria-orientation", "horizontal") : D && b.setAttribute("aria-orientation", "vertical");
|
|
882
932
|
const P = [];
|
|
@@ -908,11 +958,11 @@ class L extends G {
|
|
|
908
958
|
if (!t) return;
|
|
909
959
|
const e = this.rootEl.getBoundingClientRect();
|
|
910
960
|
if (this.cornerResizeState) {
|
|
911
|
-
const
|
|
912
|
-
if (
|
|
913
|
-
const m =
|
|
914
|
-
|
|
915
|
-
k !==
|
|
961
|
+
const a = this.cornerResizeState, c = a.hs[0], l = a.vs[0], h = this.findSplitterByPath(c.path.segments), u = this.findSplitterByPath(l.path.segments), f = h ? this.getSplitterDividers(h)[c.index] : null, p = u ? this.getSplitterDividers(u)[l.index] : null;
|
|
962
|
+
if (f && p) {
|
|
963
|
+
const m = f.getBoundingClientRect(), g = p.getBoundingClientRect(), y = g.left + g.width / 2 - e.left, b = m.top + m.height / 2 - e.top;
|
|
964
|
+
a.handle.style.left = `${y}px`, a.handle.style.top = `${b}px`, Array.from(t.querySelectorAll(".dock-intersection-handle")).forEach((k) => {
|
|
965
|
+
k !== a.handle && k.remove();
|
|
916
966
|
});
|
|
917
967
|
}
|
|
918
968
|
return;
|
|
@@ -921,32 +971,32 @@ class L extends G {
|
|
|
921
971
|
const i = [], n = [];
|
|
922
972
|
Array.from(
|
|
923
973
|
this.shadowRoot?.querySelectorAll(".dock-split") ?? []
|
|
924
|
-
).forEach((
|
|
925
|
-
const c =
|
|
926
|
-
this.getSplitterDividers(
|
|
927
|
-
const
|
|
928
|
-
c === "horizontal" ? n.push(
|
|
974
|
+
).forEach((a) => {
|
|
975
|
+
const c = a.dataset.direction, l = a.dataset.path ?? "", h = this.splitterLayerKey(a);
|
|
976
|
+
this.getSplitterDividers(a).forEach((u, f) => {
|
|
977
|
+
const p = { rect: u.getBoundingClientRect(), pathStr: l, index: f, layerKey: h };
|
|
978
|
+
c === "horizontal" ? n.push(p) : c === "vertical" && i.push(p);
|
|
929
979
|
});
|
|
930
980
|
});
|
|
931
981
|
const r = 24, d = /* @__PURE__ */ new Map();
|
|
932
|
-
i.forEach((
|
|
933
|
-
const c =
|
|
982
|
+
i.forEach((a) => {
|
|
983
|
+
const c = a.rect.top + a.rect.height / 2;
|
|
934
984
|
n.forEach((l) => {
|
|
935
|
-
if (
|
|
936
|
-
const
|
|
937
|
-
if (
|
|
938
|
-
const
|
|
939
|
-
y.pairs.push({ h: { pathStr:
|
|
985
|
+
if (a.layerKey !== l.layerKey) return;
|
|
986
|
+
const h = l.rect.left + l.rect.width / 2, u = h < a.rect.left ? a.rect.left - h : h > a.rect.right ? h - a.rect.right : 0, f = c < l.rect.top ? l.rect.top - c : c > l.rect.bottom ? c - l.rect.bottom : 0;
|
|
987
|
+
if (u > r || f > r) return;
|
|
988
|
+
const p = h - e.left, m = c - e.top, g = `${Math.round(p)}:${Math.round(m)}`, y = d.get(g) ?? { x: p, y: m, pairs: [] };
|
|
989
|
+
y.pairs.push({ h: { pathStr: a.pathStr, index: a.index }, v: { pathStr: l.pathStr, index: l.index } }), d.set(g, y);
|
|
940
990
|
});
|
|
941
|
-
}), d.forEach((
|
|
991
|
+
}), d.forEach((a, c) => {
|
|
942
992
|
const l = this.documentRef.createElement("div");
|
|
943
993
|
l.classList.add("dock-intersection-handle", "glyph"), l.setAttribute("role", "separator"), l.setAttribute("aria-label", "Resize split intersection");
|
|
944
|
-
const
|
|
945
|
-
l.setAttribute("aria-valuemin", "0"), l.setAttribute("aria-valuemax", "100"), l.setAttribute("aria-valuenow", String(Math.min(100, Math.max(0,
|
|
946
|
-
const
|
|
947
|
-
l.dataset.key =
|
|
948
|
-
const
|
|
949
|
-
l.addEventListener("pointerdown", (
|
|
994
|
+
const h = e.width > 0 ? Math.round(a.x / e.width * 100) : 0;
|
|
995
|
+
l.setAttribute("aria-valuemin", "0"), l.setAttribute("aria-valuemax", "100"), l.setAttribute("aria-valuenow", String(Math.min(100, Math.max(0, h)))), l.setAttribute("tabindex", "0");
|
|
996
|
+
const u = a.pairs[0], f = `${u.h.pathStr}:${u.h.index}|${u.v.pathStr}:${u.v.index}`;
|
|
997
|
+
l.dataset.key = f, l.dataset.pairs = JSON.stringify(a.pairs), l.style.left = `${a.x}px`, l.style.top = `${a.y}px`;
|
|
998
|
+
const p = { path: S(u.h.pathStr), index: u.h.index, container: this.findSplitterByPath(S(u.h.pathStr)?.segments ?? []) ?? this.rootEl, rect: new DOMRect() }, m = { path: S(u.v.pathStr), index: u.v.index, container: this.findSplitterByPath(S(u.v.pathStr)?.segments ?? []) ?? this.rootEl, rect: new DOMRect() };
|
|
999
|
+
l.addEventListener("pointerdown", (g) => this.beginCornerResize(g, p, m, l)), l.addEventListener("dblclick", (g) => this.onIntersectionDoubleClick(g, l)), l.addEventListener("keydown", (g) => this.onIntersectionKeyDown(g, l)), t.appendChild(l);
|
|
950
1000
|
});
|
|
951
1001
|
}
|
|
952
1002
|
/**
|
|
@@ -973,24 +1023,24 @@ class L extends G {
|
|
|
973
1023
|
}
|
|
974
1024
|
if (d.length === 0) return;
|
|
975
1025
|
t.preventDefault();
|
|
976
|
-
const
|
|
977
|
-
this.findSplitterByPath(
|
|
1026
|
+
const a = t.shiftKey, l = i || o ? d[0].v : d[0].h, h = S(l.pathStr);
|
|
1027
|
+
this.findSplitterByPath(h?.segments ?? [])?.resizeDividerBy?.(l.index, t.key, a);
|
|
978
1028
|
}
|
|
979
1029
|
beginCornerResize(t, e, i, n) {
|
|
980
1030
|
t.preventDefault();
|
|
981
|
-
const o = n.dataset.pairs, r = o ? JSON.parse(o) : [], d = [],
|
|
982
|
-
const
|
|
1031
|
+
const o = n.dataset.pairs, r = o ? JSON.parse(o) : [], d = [], a = [], c = (l, h, u) => {
|
|
1032
|
+
const f = S(l);
|
|
1033
|
+
if (!f) return;
|
|
1034
|
+
const p = this.findSplitterByPath(f.segments);
|
|
983
1035
|
if (!p) return;
|
|
984
|
-
const
|
|
985
|
-
if (!g) return;
|
|
986
|
-
const m = this.getSplitterPanels(g);
|
|
1036
|
+
const m = this.getSplitterPanels(p);
|
|
987
1037
|
if (m.length === 0) return;
|
|
988
|
-
const
|
|
989
|
-
|
|
1038
|
+
const g = u === "h" ? "height" : "width", y = m.map((k) => k.getBoundingClientRect()[g]), b = { path: f, index: h, container: p, initialSizes: y, before: y[h], after: y[h + 1] };
|
|
1039
|
+
u === "h" ? d.push(b) : a.push(b);
|
|
990
1040
|
};
|
|
991
1041
|
if (r.length > 0 ? r.forEach((l) => {
|
|
992
1042
|
c(l.h.pathStr, l.h.index, "h"), c(l.v.pathStr, l.v.index, "v");
|
|
993
|
-
}) : e.path && i.path && (c(w(e.path), e.index, "h"), c(w(i.path), i.index, "v")), !(d.length === 0 &&
|
|
1043
|
+
}) : e.path && i.path && (c(w(e.path), e.index, "h"), c(w(i.path), i.index, "v")), !(d.length === 0 && a.length === 0)) {
|
|
994
1044
|
try {
|
|
995
1045
|
n.setPointerCapture(t.pointerId), n.dataset.resizing = "true", n.classList.add("hovering");
|
|
996
1046
|
} catch {
|
|
@@ -998,30 +1048,30 @@ class L extends G {
|
|
|
998
1048
|
this.cornerResizeState = {
|
|
999
1049
|
pointerId: t.pointerId,
|
|
1000
1050
|
handle: n,
|
|
1001
|
-
hs: d.map((l) => ({ path:
|
|
1002
|
-
vs:
|
|
1003
|
-
}, this.startPointerTracking(), n.dataset.key || (n.dataset.key = n.dataset.group ?? "")
|
|
1051
|
+
hs: d.map((l) => ({ path: T(l.path), index: l.index, container: l.container, beforeSize: l.before, afterSize: l.after, initialSizes: l.initialSizes, startY: t.clientY })),
|
|
1052
|
+
vs: a.map((l) => ({ path: T(l.path), index: l.index, container: l.container, beforeSize: l.before, afterSize: l.after, initialSizes: l.initialSizes, startX: t.clientX }))
|
|
1053
|
+
}, this.startPointerTracking(), n.dataset.key || (n.dataset.key = n.dataset.group ?? "");
|
|
1004
1054
|
try {
|
|
1005
1055
|
const l = this.rootEl.getBoundingClientRect();
|
|
1006
|
-
let
|
|
1007
|
-
if (
|
|
1008
|
-
const
|
|
1009
|
-
b && (
|
|
1056
|
+
let h = null, u = null;
|
|
1057
|
+
if (a.length > 0) {
|
|
1058
|
+
const g = a[0], b = this.getSplitterDividers(g.container)[g.index]?.getBoundingClientRect();
|
|
1059
|
+
b && (h = b.left + b.width / 2);
|
|
1010
1060
|
}
|
|
1011
1061
|
if (d.length > 0) {
|
|
1012
|
-
const
|
|
1013
|
-
b && (
|
|
1062
|
+
const g = d[0], b = this.getSplitterDividers(g.container)[g.index]?.getBoundingClientRect();
|
|
1063
|
+
b && (u = b.top + b.height / 2);
|
|
1014
1064
|
}
|
|
1015
|
-
const
|
|
1065
|
+
const f = [], p = [];
|
|
1016
1066
|
Array.from(
|
|
1017
1067
|
this.shadowRoot?.querySelectorAll(".dock-split") ?? []
|
|
1018
|
-
).forEach((
|
|
1019
|
-
const y =
|
|
1020
|
-
this.getSplitterDividers(
|
|
1068
|
+
).forEach((g) => {
|
|
1069
|
+
const y = g.dataset.direction ?? void 0;
|
|
1070
|
+
this.getSplitterDividers(g).forEach((b) => {
|
|
1021
1071
|
const k = b.getBoundingClientRect();
|
|
1022
|
-
y === "horizontal" &&
|
|
1072
|
+
y === "horizontal" && u != null ? u >= k.top && u <= k.bottom && f.push(k.left + k.width / 2 - l.left) : y === "vertical" && h != null && h >= k.left && h <= k.right && p.push(k.top + k.height / 2 - l.top);
|
|
1023
1073
|
});
|
|
1024
|
-
}), this.cornerSnapXTargets =
|
|
1074
|
+
}), this.cornerSnapXTargets = f, this.cornerSnapYTargets = p;
|
|
1025
1075
|
} catch {
|
|
1026
1076
|
this.cornerSnapXTargets = [], this.cornerSnapYTargets = [];
|
|
1027
1077
|
}
|
|
@@ -1030,29 +1080,29 @@ class L extends G {
|
|
|
1030
1080
|
handleCornerResizeMove(t) {
|
|
1031
1081
|
const e = this.cornerResizeState;
|
|
1032
1082
|
if (!e || e.pointerId !== t.pointerId) return;
|
|
1033
|
-
const i = 10, n = this.rootEl.getBoundingClientRect(), o =
|
|
1083
|
+
const i = 10, n = this.rootEl.getBoundingClientRect(), o = q(
|
|
1034
1084
|
t.clientX,
|
|
1035
|
-
this.cornerSnapXTargets.map((
|
|
1085
|
+
this.cornerSnapXTargets.map((a) => n.left + a),
|
|
1036
1086
|
i
|
|
1037
|
-
), r =
|
|
1087
|
+
), r = q(
|
|
1038
1088
|
t.clientY,
|
|
1039
|
-
this.cornerSnapYTargets.map((
|
|
1089
|
+
this.cornerSnapYTargets.map((a) => n.top + a),
|
|
1040
1090
|
i
|
|
1041
|
-
), d = (
|
|
1042
|
-
const l = this.
|
|
1091
|
+
), d = (a, c) => {
|
|
1092
|
+
const l = A(a.path, this.rootLayout, this.floatingLayouts);
|
|
1043
1093
|
if (!l) return;
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1046
|
-
|
|
1094
|
+
const h = 48, { before: u, after: f } = mt(
|
|
1095
|
+
a.beforeSize,
|
|
1096
|
+
a.afterSize,
|
|
1047
1097
|
c,
|
|
1048
|
-
|
|
1098
|
+
h,
|
|
1049
1099
|
t.shiftKey
|
|
1050
|
-
),
|
|
1051
|
-
|
|
1052
|
-
const m =
|
|
1053
|
-
l.sizes = m > 0 ?
|
|
1100
|
+
), p = [...a.initialSizes];
|
|
1101
|
+
p[a.index] = u, p[a.index + 1] = f;
|
|
1102
|
+
const m = p.reduce((g, y) => g + y, 0);
|
|
1103
|
+
l.sizes = m > 0 ? p.map((g) => g / m) : [], a.container.setPanelSizes?.(p);
|
|
1054
1104
|
};
|
|
1055
|
-
e.hs.forEach((
|
|
1105
|
+
e.hs.forEach((a) => d(a, r - a.startY)), e.vs.forEach((a) => d(a, o - a.startX)), this.dispatchLayoutChanged(), this.scheduleRenderIntersectionHandles();
|
|
1056
1106
|
}
|
|
1057
1107
|
endCornerResize(t) {
|
|
1058
1108
|
const e = this.cornerResizeState;
|
|
@@ -1066,69 +1116,39 @@ class L extends G {
|
|
|
1066
1116
|
}
|
|
1067
1117
|
onIntersectionDoubleClick(t, e) {
|
|
1068
1118
|
t.preventDefault();
|
|
1069
|
-
const i = e.dataset.pairs,
|
|
1070
|
-
if (
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
}
|
|
1119
|
+
const i = at(e.dataset.pairs, e.dataset.key);
|
|
1120
|
+
if (i.length === 0) return;
|
|
1121
|
+
const n = ct(
|
|
1122
|
+
i,
|
|
1123
|
+
this.previousSplitSizes,
|
|
1124
|
+
(o) => {
|
|
1125
|
+
const r = S(o), d = r ? A(r, this.rootLayout, this.floatingLayouts) : null;
|
|
1126
|
+
return d ? { sizes: d.sizes, childCount: d.children.length } : null;
|
|
1078
1127
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
const g = x(p.sizes ?? [], p.children.length), m = u([...g], l);
|
|
1104
|
-
p.sizes = m, d(h, m);
|
|
1105
|
-
};
|
|
1106
|
-
if (r)
|
|
1107
|
-
this.previousSplitSizes.forEach((c, l) => {
|
|
1108
|
-
const u = S(l), h = u ? this.resolveSplitNode(u) : null;
|
|
1109
|
-
if (!h || !u) return;
|
|
1110
|
-
const p = x(c, h.children.length);
|
|
1111
|
-
h.sizes = p, d(u, p);
|
|
1112
|
-
}), this.previousSplitSizes.clear();
|
|
1113
|
-
else {
|
|
1114
|
-
const c = /* @__PURE__ */ new Set();
|
|
1115
|
-
n.forEach((l) => {
|
|
1116
|
-
[l.h.pathStr, l.v.pathStr].forEach((h) => {
|
|
1117
|
-
if (c.has(h)) return;
|
|
1118
|
-
const p = S(h), g = p ? this.resolveSplitNode(p) : null;
|
|
1119
|
-
g && Array.isArray(g.sizes) && this.previousSplitSizes.set(h, [...g.sizes]), c.add(h);
|
|
1120
|
-
});
|
|
1121
|
-
const u = (h, p) => {
|
|
1122
|
-
const g = (h[p] ?? 0) + (h[p + 1] ?? 0);
|
|
1123
|
-
if (g <= 0) return h;
|
|
1124
|
-
h[p] = g / 2, h[p + 1] = g / 2;
|
|
1125
|
-
const m = h.reduce((f, y) => f + y, 0);
|
|
1126
|
-
return m > 0 ? h.map((f) => f / m) : h;
|
|
1127
|
-
};
|
|
1128
|
-
s(l.h.pathStr, l.h.index, u), s(l.v.pathStr, l.v.index, u);
|
|
1129
|
-
});
|
|
1130
|
-
}
|
|
1131
|
-
this.dispatchLayoutChanged(), this.scheduleRenderIntersectionHandles();
|
|
1128
|
+
);
|
|
1129
|
+
n.remember.forEach(({ pathStr: o, sizes: r }) => this.previousSplitSizes.set(o, r)), n.writes.forEach(({ pathStr: o, sizes: r }) => {
|
|
1130
|
+
const d = S(o), a = d ? A(d, this.rootLayout, this.floatingLayouts) : null;
|
|
1131
|
+
!a || !d || (a.sizes = r, this.pushSizesToSplitter(d, r));
|
|
1132
|
+
}), n.clearStored && this.previousSplitSizes.clear(), this.dispatchLayoutChanged(), this.scheduleRenderIntersectionHandles();
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Push normalized weights into the matching `<mp-splitter>` as pixel sizes.
|
|
1136
|
+
* The splitter's panel wrappers live in its shadow DOM, so direct flex
|
|
1137
|
+
* mutation is not an option.
|
|
1138
|
+
*
|
|
1139
|
+
* Returns without writing when the splitter has no measured size — which is
|
|
1140
|
+
* every case under jsdom, and is why the double-click logic above had to move
|
|
1141
|
+
* out of this method's shadow to become testable.
|
|
1142
|
+
*/
|
|
1143
|
+
pushSizesToSplitter(t, e) {
|
|
1144
|
+
const i = this.findSplitterByPath(t.segments);
|
|
1145
|
+
if (!i) return;
|
|
1146
|
+
const o = (i.dataset.direction ?? "horizontal") === "horizontal" ? i.getBoundingClientRect().width : i.getBoundingClientRect().height;
|
|
1147
|
+
if (!Number.isFinite(o) || o <= 0) return;
|
|
1148
|
+
const r = e.reduce((a, c) => a + Math.max(c, 0), 0);
|
|
1149
|
+
if (r <= 0) return;
|
|
1150
|
+
const d = e.map((a) => Math.max(a, 0) / r * o);
|
|
1151
|
+
i.setPanelSizes?.(d);
|
|
1132
1152
|
}
|
|
1133
1153
|
beginFloatingDrag(t, e, i, n) {
|
|
1134
1154
|
const o = this.floatingLayouts[e];
|
|
@@ -1169,11 +1189,11 @@ class L extends G {
|
|
|
1169
1189
|
if (t.altKey || t.ctrlKey || t.metaKey) return;
|
|
1170
1190
|
const r = t.key === "ArrowLeft" ? -1 : t.key === "ArrowRight" ? 1 : 0, d = t.key === "ArrowUp" ? -1 : t.key === "ArrowDown" ? 1 : 0;
|
|
1171
1191
|
if (r === 0 && d === 0 || r !== 0 && o.horizontal === "none" || d !== 0 && o.vertical === "none") return;
|
|
1172
|
-
const
|
|
1173
|
-
if (!
|
|
1192
|
+
const a = this.floatingLayouts[e];
|
|
1193
|
+
if (!a) return;
|
|
1174
1194
|
t.preventDefault(), t.stopPropagation();
|
|
1175
|
-
const c = t.shiftKey ? 1 : 10, l =
|
|
1176
|
-
|
|
1195
|
+
const c = t.shiftKey ? 1 : 10, l = Z(
|
|
1196
|
+
a.bounds,
|
|
1177
1197
|
o,
|
|
1178
1198
|
{ x: r * c, y: d * c },
|
|
1179
1199
|
this.getHostSize()
|
|
@@ -1254,7 +1274,7 @@ class L extends G {
|
|
|
1254
1274
|
const e = this.floatingResizeState;
|
|
1255
1275
|
if (!e || t.pointerId !== e.pointerId)
|
|
1256
1276
|
return;
|
|
1257
|
-
const i =
|
|
1277
|
+
const i = Z(
|
|
1258
1278
|
{
|
|
1259
1279
|
left: e.startLeft,
|
|
1260
1280
|
top: e.startTop,
|
|
@@ -1302,18 +1322,18 @@ class L extends G {
|
|
|
1302
1322
|
this.floatingLayouts.forEach((e, i) => {
|
|
1303
1323
|
const n = this.floatingLayerEl.children[i];
|
|
1304
1324
|
if (!n) return;
|
|
1305
|
-
const { left: o, top: r, width: d, height:
|
|
1306
|
-
n.style.left = `${o}px`, n.style.top = `${r}px`, n.style.width = `${d}px`, n.style.height = `${
|
|
1325
|
+
const { left: o, top: r, width: d, height: a } = R(e.bounds, t);
|
|
1326
|
+
n.style.left = `${o}px`, n.style.top = `${r}px`, n.style.width = `${d}px`, n.style.height = `${a}px`, n.style.minWidth = "0", n.style.minHeight = "0";
|
|
1307
1327
|
});
|
|
1308
1328
|
}
|
|
1309
1329
|
promoteFloatingPane(t, e) {
|
|
1310
1330
|
const i = this.floatingLayouts[t];
|
|
1311
1331
|
if (!i)
|
|
1312
1332
|
return;
|
|
1313
|
-
const n = this.floatingLayouts.reduce((r, d,
|
|
1333
|
+
const n = this.floatingLayouts.reduce((r, d, a) => {
|
|
1314
1334
|
if (!d)
|
|
1315
1335
|
return r;
|
|
1316
|
-
const c =
|
|
1336
|
+
const c = a === t ? Number.NEGATIVE_INFINITY : H(this.floatingLayouts[a], a);
|
|
1317
1337
|
return Math.max(r, c);
|
|
1318
1338
|
}, 0), o = Math.max(n + 2, 12);
|
|
1319
1339
|
i.zIndex = o, e.style.zIndex = String(o);
|
|
@@ -1363,29 +1383,29 @@ class L extends G {
|
|
|
1363
1383
|
const n = this.documentRef.createElement("mp-splitter");
|
|
1364
1384
|
n.classList.add("dock-split"), n.dataset.direction = t.direction, n.dataset.path = e.join("/"), n.setAttribute("orientation", t.direction);
|
|
1365
1385
|
const o = typeof i == "number" ? { type: "floating", index: i, segments: [...e] } : { type: "docked", segments: [...e] };
|
|
1366
|
-
t.children.forEach((d,
|
|
1367
|
-
n.appendChild(this.renderNode(d, [...e,
|
|
1386
|
+
t.children.forEach((d, a) => {
|
|
1387
|
+
n.appendChild(this.renderNode(d, [...e, a], i));
|
|
1368
1388
|
});
|
|
1369
1389
|
const r = Array.isArray(t.sizes) ? t.sizes : [];
|
|
1370
1390
|
return r.length > 0 && requestAnimationFrame(() => {
|
|
1371
|
-
const d = r.reduce((l,
|
|
1391
|
+
const d = r.reduce((l, h) => l + Math.max(h, 0), 0);
|
|
1372
1392
|
if (d <= 0) return;
|
|
1373
|
-
const
|
|
1374
|
-
if (!Number.isFinite(
|
|
1375
|
-
const c = r.map((l) => Math.max(l, 0) / d *
|
|
1393
|
+
const a = t.direction === "horizontal" ? n.getBoundingClientRect().width : n.getBoundingClientRect().height;
|
|
1394
|
+
if (!Number.isFinite(a) || a <= 0) return;
|
|
1395
|
+
const c = r.map((l) => Math.max(l, 0) / d * a);
|
|
1376
1396
|
n.setPanelSizes?.(c), requestAnimationFrame(() => this.scheduleRenderIntersectionHandles());
|
|
1377
1397
|
}), n.addEventListener("resize-end", (d) => {
|
|
1378
1398
|
if (d.target !== n) return;
|
|
1379
|
-
const
|
|
1380
|
-
if (!Array.isArray(
|
|
1381
|
-
const c = this.
|
|
1399
|
+
const a = d.detail;
|
|
1400
|
+
if (!Array.isArray(a?.sizes) || a.sizes.length === 0) return;
|
|
1401
|
+
const c = A(o, this.rootLayout, this.floatingLayouts);
|
|
1382
1402
|
if (!c) return;
|
|
1383
1403
|
const l = (c.sizes ?? []).reduce(
|
|
1384
|
-
(
|
|
1404
|
+
(f, p) => f + Math.max(p, 0),
|
|
1385
1405
|
0
|
|
1386
|
-
),
|
|
1387
|
-
|
|
1388
|
-
(
|
|
1406
|
+
), h = a.sizes.reduce((f, p) => f + Math.max(p, 0), 0), u = l > 0 ? l : a.sizes.length;
|
|
1407
|
+
h > 0 && (c.sizes = a.sizes.map(
|
|
1408
|
+
(f) => Math.max(f, 0) / h * u
|
|
1389
1409
|
), this.dispatchLayoutChanged());
|
|
1390
1410
|
}), n;
|
|
1391
1411
|
}
|
|
@@ -1398,26 +1418,26 @@ class L extends G {
|
|
|
1398
1418
|
if (r.length === 0) {
|
|
1399
1419
|
const l = this.documentRef.createElement("span");
|
|
1400
1420
|
l.setAttribute("slot", "__empty__-header"), l.textContent = "(empty)";
|
|
1401
|
-
const
|
|
1402
|
-
return
|
|
1421
|
+
const h = this.documentRef.createElement("div");
|
|
1422
|
+
return h.setAttribute("slot", "__empty__-content"), h.classList.add("dock-stack__pane"), h.textContent = "No panes configured", n.append(l, h), n.setAttribute("active-tab", "__empty__"), n;
|
|
1403
1423
|
}
|
|
1404
|
-
const d = r.includes(t.activePane ?? "") ? t.activePane : r[0],
|
|
1424
|
+
const d = r.includes(t.activePane ?? "") ? t.activePane : r[0], a = e.length ? e.join("-") : "root", c = typeof i == "number" ? `f${i}-${a}` : a;
|
|
1405
1425
|
return r.forEach((l) => {
|
|
1406
|
-
const
|
|
1407
|
-
m.setAttribute("slot", `${
|
|
1408
|
-
this.captureTabDragMetrics(b, n), this.armPaneDragGesture(b,
|
|
1426
|
+
const h = l.replace(/[^a-zA-Z0-9_-]/g, "-"), u = h.length > 0 ? h : "pane", f = `${this.instanceId}-tab-${c}-${u}`, p = `${this.instanceId}-panel-${c}-${u}`, m = this.documentRef.createElement("span");
|
|
1427
|
+
m.setAttribute("slot", `${f}-header`), m.classList.add("dock-tab"), m.dataset.pane = l, m.dataset.tabId = f, m.textContent = this.titles[l] ?? l, m.addEventListener("pointerdown", (b) => {
|
|
1428
|
+
this.captureTabDragMetrics(b, n), this.armPaneDragGesture(b, T(o), l, n), b.stopPropagation();
|
|
1409
1429
|
});
|
|
1410
|
-
const
|
|
1411
|
-
|
|
1430
|
+
const g = this.documentRef.createElement("div");
|
|
1431
|
+
g.setAttribute("slot", `${f}-content`), g.classList.add("dock-stack__pane"), g.dataset.pane = l, g.dataset.tabId = f, g.id = p;
|
|
1412
1432
|
const y = this.documentRef.createElement("slot");
|
|
1413
|
-
y.name = l,
|
|
1433
|
+
y.name = l, g.appendChild(y), n.append(m, g), l === d && n.setAttribute("active-tab", f);
|
|
1414
1434
|
}), n.dataset.activePane = d, n.addEventListener("tab-activate", (l) => {
|
|
1415
|
-
const
|
|
1416
|
-
`:scope > [data-tab-id="${
|
|
1435
|
+
const h = l.detail, f = n.querySelector(
|
|
1436
|
+
`:scope > [data-tab-id="${h.tabId}"]`
|
|
1417
1437
|
)?.dataset.pane;
|
|
1418
|
-
|
|
1438
|
+
f && (this.activatePane(n, f, T(o)), this.dispatchEvent(
|
|
1419
1439
|
new CustomEvent("dock-pane-activated", {
|
|
1420
|
-
detail: { pane:
|
|
1440
|
+
detail: { pane: f },
|
|
1421
1441
|
bubbles: !0,
|
|
1422
1442
|
composed: !0
|
|
1423
1443
|
})
|
|
@@ -1500,12 +1520,12 @@ class L extends G {
|
|
|
1500
1520
|
this.pendingTabDragMetrics = null;
|
|
1501
1521
|
return;
|
|
1502
1522
|
}
|
|
1503
|
-
const i = this.getBoundingClientRect(), n = e.getBoundingClientRect(), o = t.clientX - n.left, r = t.clientY - n.top, d = n.left - i.left,
|
|
1523
|
+
const i = this.getBoundingClientRect(), n = e.getBoundingClientRect(), o = t.clientX - n.left, r = t.clientY - n.top, d = n.left - i.left, a = n.top - i.top, c = Number.isFinite(n.width) ? n.width : 0, l = Number.isFinite(n.height) ? n.height : 0;
|
|
1504
1524
|
this.pendingTabDragMetrics = {
|
|
1505
1525
|
pointerOffsetX: o,
|
|
1506
1526
|
pointerOffsetY: r,
|
|
1507
1527
|
left: d,
|
|
1508
|
-
top:
|
|
1528
|
+
top: a,
|
|
1509
1529
|
width: c,
|
|
1510
1530
|
height: l,
|
|
1511
1531
|
startClientX: t.clientX,
|
|
@@ -1531,18 +1551,18 @@ class L extends G {
|
|
|
1531
1551
|
if (t.pointerType === "mouse" && t.button !== 0) return;
|
|
1532
1552
|
const o = this.windowRef;
|
|
1533
1553
|
if (!o) return;
|
|
1534
|
-
const r = t.clientX, d = t.clientY,
|
|
1554
|
+
const r = t.clientX, d = t.clientY, a = t.pointerId, c = 5;
|
|
1535
1555
|
let l = !1;
|
|
1536
|
-
const
|
|
1537
|
-
l = !0, o.removeEventListener("pointermove",
|
|
1538
|
-
},
|
|
1539
|
-
if (l ||
|
|
1540
|
-
const m =
|
|
1541
|
-
Math.hypot(m,
|
|
1542
|
-
},
|
|
1543
|
-
l ||
|
|
1556
|
+
const h = () => {
|
|
1557
|
+
l = !0, o.removeEventListener("pointermove", u, !0), o.removeEventListener("pointerup", f, !0), o.removeEventListener("pointercancel", f, !0);
|
|
1558
|
+
}, u = (p) => {
|
|
1559
|
+
if (l || p.pointerId !== a) return;
|
|
1560
|
+
const m = p.clientX - r, g = p.clientY - d;
|
|
1561
|
+
Math.hypot(m, g) < c || (h(), this.beginPaneDrag(p, e, i, n));
|
|
1562
|
+
}, f = (p) => {
|
|
1563
|
+
l || p.pointerId !== a || (h(), this.clearPendingTabDragMetrics());
|
|
1544
1564
|
};
|
|
1545
|
-
o.addEventListener("pointermove",
|
|
1565
|
+
o.addEventListener("pointermove", u, !0), o.addEventListener("pointerup", f, !0), o.addEventListener("pointercancel", f, !0);
|
|
1546
1566
|
}
|
|
1547
1567
|
/**
|
|
1548
1568
|
* Touch-specific gesture arming. With `.dock-tab` set to `touch-action:
|
|
@@ -1568,38 +1588,38 @@ class L extends G {
|
|
|
1568
1588
|
armPaneDragGestureTouch(t, e, i, n) {
|
|
1569
1589
|
const o = this.windowRef;
|
|
1570
1590
|
if (!o) return;
|
|
1571
|
-
const r = t.clientX, d = t.clientY,
|
|
1572
|
-
let c = r, l = d,
|
|
1573
|
-
const m = t.currentTarget instanceof HTMLElement ? t.currentTarget : t.target instanceof HTMLElement ? t.target.closest(".dock-tab") : null,
|
|
1591
|
+
const r = t.clientX, d = t.clientY, a = t.pointerId;
|
|
1592
|
+
let c = r, l = d, h = r, u = !1, f = !1, p = !1;
|
|
1593
|
+
const m = t.currentTarget instanceof HTMLElement ? t.currentTarget : t.target instanceof HTMLElement ? t.target.closest(".dock-tab") : null, g = n ? this.getStackStripEl(n)?.querySelector(
|
|
1574
1594
|
"ul.nav.nav-tabs"
|
|
1575
1595
|
) ?? null : null, y = () => {
|
|
1576
|
-
|
|
1596
|
+
u || (u = !0, o.clearTimeout(P), o.clearTimeout(z), o.removeEventListener("pointermove", b, !0), o.removeEventListener("pointerup", k, !0), o.removeEventListener("pointercancel", D, !0), p && m && m.removeAttribute("data-pressing"));
|
|
1577
1597
|
}, b = (v) => {
|
|
1578
|
-
if (
|
|
1579
|
-
if (
|
|
1580
|
-
const
|
|
1581
|
-
|
|
1598
|
+
if (u || v.pointerId !== a) return;
|
|
1599
|
+
if (f) {
|
|
1600
|
+
const G = v.clientX - h;
|
|
1601
|
+
h = v.clientX, g && (g.scrollLeft -= G);
|
|
1582
1602
|
return;
|
|
1583
1603
|
}
|
|
1584
1604
|
c = v.clientX, l = v.clientY;
|
|
1585
|
-
const
|
|
1586
|
-
if (Math.hypot(
|
|
1605
|
+
const O = v.clientX - r, Y = v.clientY - d;
|
|
1606
|
+
if (Math.hypot(O, Y) <= L.TOUCH_LONG_PRESS_SLOP_PX)
|
|
1587
1607
|
return;
|
|
1588
|
-
const
|
|
1589
|
-
if (Math.abs(
|
|
1590
|
-
o.clearTimeout(P), o.clearTimeout(z),
|
|
1608
|
+
const V = !!g && g.scrollWidth > g.clientWidth;
|
|
1609
|
+
if (Math.abs(O) > Math.abs(Y) && V) {
|
|
1610
|
+
o.clearTimeout(P), o.clearTimeout(z), p && m && (m.removeAttribute("data-pressing"), p = !1), f = !0, h = v.clientX, g.scrollLeft -= O, this.clearPendingTabDragMetrics();
|
|
1591
1611
|
return;
|
|
1592
1612
|
}
|
|
1593
1613
|
y(), this.clearPendingTabDragMetrics();
|
|
1594
1614
|
}, k = (v) => {
|
|
1595
|
-
|
|
1615
|
+
u || v.pointerId !== a || (y(), this.clearPendingTabDragMetrics());
|
|
1596
1616
|
}, D = (v) => {
|
|
1597
|
-
|
|
1617
|
+
u || v.pointerId !== a || (y(), this.clearPendingTabDragMetrics());
|
|
1598
1618
|
}, P = o.setTimeout(() => {
|
|
1599
|
-
if (
|
|
1619
|
+
if (u) return;
|
|
1600
1620
|
y();
|
|
1601
1621
|
try {
|
|
1602
|
-
this.setPointerCapture(
|
|
1622
|
+
this.setPointerCapture(a);
|
|
1603
1623
|
} catch {
|
|
1604
1624
|
}
|
|
1605
1625
|
if (typeof navigator < "u" && typeof navigator.vibrate == "function")
|
|
@@ -1608,7 +1628,7 @@ class L extends G {
|
|
|
1608
1628
|
} catch {
|
|
1609
1629
|
}
|
|
1610
1630
|
const v = new PointerEvent("pointermove", {
|
|
1611
|
-
pointerId:
|
|
1631
|
+
pointerId: a,
|
|
1612
1632
|
pointerType: "touch",
|
|
1613
1633
|
isPrimary: !0,
|
|
1614
1634
|
clientX: c,
|
|
@@ -1618,7 +1638,7 @@ class L extends G {
|
|
|
1618
1638
|
});
|
|
1619
1639
|
this.beginPaneDrag(v, e, i, n);
|
|
1620
1640
|
}, L.TOUCH_LONG_PRESS_MS), z = o.setTimeout(() => {
|
|
1621
|
-
|
|
1641
|
+
u || !m || (p = !0, m.setAttribute("data-pressing", "true"));
|
|
1622
1642
|
}, L.TOUCH_PRESS_FEEDBACK_DELAY_MS);
|
|
1623
1643
|
o.addEventListener("pointermove", b, !0), o.addEventListener("pointerup", k, !0), o.addEventListener("pointercancel", D, !0);
|
|
1624
1644
|
}
|
|
@@ -1627,33 +1647,33 @@ class L extends G {
|
|
|
1627
1647
|
path: o,
|
|
1628
1648
|
floatingIndex: r,
|
|
1629
1649
|
pointerOffsetX: d,
|
|
1630
|
-
pointerOffsetY:
|
|
1631
|
-
} = this.preparePaneDragSource(e, i, n, t), c = n ? this.getStackStripEl(n) : null, l = c ? c.getBoundingClientRect() : null,
|
|
1650
|
+
pointerOffsetY: a
|
|
1651
|
+
} = this.preparePaneDragSource(e, i, n, t), c = n ? this.getStackStripEl(n) : null, l = c ? c.getBoundingClientRect() : null, h = l ? { left: l.left, top: l.top, right: l.right, bottom: l.bottom } : null, u = this.pendingTabDragMetrics;
|
|
1632
1652
|
if (this.dragState = {
|
|
1633
1653
|
pane: i,
|
|
1634
|
-
sourcePath:
|
|
1654
|
+
sourcePath: T(o),
|
|
1635
1655
|
floatingIndex: r,
|
|
1636
1656
|
pointerOffsetX: d,
|
|
1637
|
-
pointerOffsetY:
|
|
1657
|
+
pointerOffsetY: a,
|
|
1638
1658
|
dropHandled: !1,
|
|
1639
1659
|
sourceStackEl: n,
|
|
1640
|
-
sourceHeaderBounds:
|
|
1641
|
-
startClientX:
|
|
1642
|
-
startClientY:
|
|
1660
|
+
sourceHeaderBounds: h,
|
|
1661
|
+
startClientX: u && Number.isFinite(u.startClientX) ? u.startClientX : t.clientX,
|
|
1662
|
+
startClientY: u && Number.isFinite(u.startClientY) ? u.startClientY : t.clientY
|
|
1643
1663
|
}, this.lastDragPointerPosition = {
|
|
1644
1664
|
x: this.dragState.startClientX,
|
|
1645
1665
|
y: this.dragState.startClientY
|
|
1646
1666
|
}, this.updateDraggedFloatingPositionFromPoint(t.clientX, t.clientY), this.startDragPointerTracking(), this.markDraggedFloatingWrapper(), this.dragState && this.dragState.floatingIndex !== null && this.dragState.floatingIndex < 0) {
|
|
1647
|
-
const
|
|
1648
|
-
if (
|
|
1649
|
-
let
|
|
1650
|
-
if (
|
|
1651
|
-
|
|
1652
|
-
else if (
|
|
1653
|
-
const m = this.floatingLayouts[
|
|
1654
|
-
|
|
1667
|
+
const f = this.resolveStackLocation(this.dragState.sourcePath);
|
|
1668
|
+
if (f && Array.isArray(f.node.panes) && f.node.panes.length === 1) {
|
|
1669
|
+
let p = !1;
|
|
1670
|
+
if (f.context === "docked")
|
|
1671
|
+
p = !0;
|
|
1672
|
+
else if (f.context === "floating") {
|
|
1673
|
+
const m = this.floatingLayouts[f.index];
|
|
1674
|
+
p = (m && m.root ? J(m.root) : 0) > 1;
|
|
1655
1675
|
}
|
|
1656
|
-
|
|
1676
|
+
p && this.convertPendingTabDragToFloating(t.clientX, t.clientY);
|
|
1657
1677
|
}
|
|
1658
1678
|
}
|
|
1659
1679
|
}
|
|
@@ -1667,18 +1687,18 @@ class L extends G {
|
|
|
1667
1687
|
pointerOffsetY: 0
|
|
1668
1688
|
};
|
|
1669
1689
|
const r = this.pendingTabDragMetrics, d = !!i && Array.from(i.querySelectorAll(".dock-tab")).some(
|
|
1670
|
-
(
|
|
1671
|
-
),
|
|
1672
|
-
if (o.context === "floating" && !!c && !
|
|
1690
|
+
(p) => p.dataset.pane && p.dataset.pane !== e
|
|
1691
|
+
), a = o.node.panes.some((p) => p !== e), c = o.context === "floating" ? this.floatingLayouts[o.index] : null, l = c && c.root ? J(c.root) : a ? 2 : 1;
|
|
1692
|
+
if (o.context === "floating" && !!c && !a && !d && l <= 1) {
|
|
1673
1693
|
if (c) {
|
|
1674
1694
|
c.activePane = e, this.updateFloatingWindowTitle(o.index);
|
|
1675
|
-
const
|
|
1676
|
-
|
|
1677
|
-
const m = this.getBoundingClientRect(),
|
|
1695
|
+
const p = this.getFloatingWrapper(o.index);
|
|
1696
|
+
p && this.promoteFloatingPane(o.index, p);
|
|
1697
|
+
const m = this.getBoundingClientRect(), g = r && Number.isFinite(r.pointerOffsetX) && Number.isFinite(r.left) && Number.isFinite(c.bounds.left) ? r.pointerOffsetX + (r.left - c.bounds.left) : Number.isFinite(n.clientX) && Number.isFinite(c.bounds.left) ? n.clientX - m.left - c.bounds.left : c.bounds.width / 2, y = r && Number.isFinite(r.pointerOffsetY) && Number.isFinite(r.top) && Number.isFinite(c.bounds.top) ? r.pointerOffsetY + (r.top - c.bounds.top) : Number.isFinite(n.clientY) && Number.isFinite(c.bounds.top) ? n.clientY - m.top - c.bounds.top : c.bounds.height / 2;
|
|
1678
1698
|
return {
|
|
1679
1699
|
path: t,
|
|
1680
1700
|
floatingIndex: o.index,
|
|
1681
|
-
pointerOffsetX:
|
|
1701
|
+
pointerOffsetX: g,
|
|
1682
1702
|
pointerOffsetY: y
|
|
1683
1703
|
};
|
|
1684
1704
|
}
|
|
@@ -1689,12 +1709,12 @@ class L extends G {
|
|
|
1689
1709
|
pointerOffsetY: 0
|
|
1690
1710
|
};
|
|
1691
1711
|
}
|
|
1692
|
-
const
|
|
1712
|
+
const u = r && Number.isFinite(r.pointerOffsetX) ? r.pointerOffsetX : 0, f = r && Number.isFinite(r.pointerOffsetY) ? r.pointerOffsetY : 0;
|
|
1693
1713
|
return {
|
|
1694
1714
|
path: t,
|
|
1695
1715
|
floatingIndex: -1,
|
|
1696
|
-
pointerOffsetX:
|
|
1697
|
-
pointerOffsetY:
|
|
1716
|
+
pointerOffsetX: u,
|
|
1717
|
+
pointerOffsetY: f
|
|
1698
1718
|
};
|
|
1699
1719
|
}
|
|
1700
1720
|
endPaneDrag() {
|
|
@@ -1706,10 +1726,10 @@ class L extends G {
|
|
|
1706
1726
|
if (!this.dragState || !Number.isFinite(t) || !Number.isFinite(e))
|
|
1707
1727
|
return;
|
|
1708
1728
|
if (this.dragState.floatingIndex !== null && this.dragState.floatingIndex < 0) {
|
|
1709
|
-
const
|
|
1710
|
-
let
|
|
1711
|
-
const y =
|
|
1712
|
-
|
|
1729
|
+
const h = this.dragState.sourceHeaderBounds, u = this.dragState.startClientX ?? t, f = this.dragState.startClientY ?? e, p = Math.hypot(t - u, e - f), m = 8;
|
|
1730
|
+
let g = !0;
|
|
1731
|
+
const y = h ? j(h, t, e) : !0, b = this.isPointerOverSourceHeader(t, e);
|
|
1732
|
+
g = y || b, !g && p > m && this.convertPendingTabDragToFloating(t, e);
|
|
1713
1733
|
}
|
|
1714
1734
|
this.updatePaneDragDropTargetFromPoint(t, e);
|
|
1715
1735
|
const { floatingIndex: i, pointerOffsetX: n, pointerOffsetY: o } = this.dragState;
|
|
@@ -1718,10 +1738,10 @@ class L extends G {
|
|
|
1718
1738
|
const r = this.floatingLayouts[i];
|
|
1719
1739
|
if (!r)
|
|
1720
1740
|
return;
|
|
1721
|
-
const d = this.getBoundingClientRect(),
|
|
1722
|
-
r.bounds.left =
|
|
1741
|
+
const d = this.getBoundingClientRect(), a = t - d.left - n, c = e - d.top - o;
|
|
1742
|
+
r.bounds.left = a, r.bounds.top = c;
|
|
1723
1743
|
const l = this.getFloatingWrapper(i);
|
|
1724
|
-
l && (l.style.left = `${
|
|
1744
|
+
l && (l.style.left = `${a}px`, l.style.top = `${c}px`);
|
|
1725
1745
|
}
|
|
1726
1746
|
updatePaneDragDropTargetFromPoint(t, e) {
|
|
1727
1747
|
if (!this.dragState)
|
|
@@ -1731,9 +1751,9 @@ class L extends G {
|
|
|
1731
1751
|
this.dropJoystick.dataset.visible !== "true" && this.hideDropIndicator(), this.clearHeaderDragPlaceholder();
|
|
1732
1752
|
return;
|
|
1733
1753
|
}
|
|
1734
|
-
if (this.dropJoystickTarget && this.dropJoystickTarget !== i && (delete this.dropJoystick.dataset.zone, this.updateDropJoystickActiveZone(null)), this.dragState && this.dragState.floatingIndex !== null && this.dragState.floatingIndex < 0 && n &&
|
|
1735
|
-
const d = !!this.dragState.sourceHeaderBounds &&
|
|
1736
|
-
if (d ||
|
|
1754
|
+
if (this.dropJoystickTarget && this.dropJoystickTarget !== i && (delete this.dropJoystick.dataset.zone, this.updateDropJoystickActiveZone(null)), this.dragState && this.dragState.floatingIndex !== null && this.dragState.floatingIndex < 0 && n && B(n, this.dragState.sourcePath)) {
|
|
1755
|
+
const d = !!this.dragState.sourceHeaderBounds && j(this.dragState.sourceHeaderBounds, t, e), a = this.isPointerOverSourceHeader(t, e);
|
|
1756
|
+
if (d || a) {
|
|
1737
1757
|
this.ensureHeaderDragPlaceholder(i, this.dragState.pane);
|
|
1738
1758
|
const c = this.computeHeaderInsertIndex(i, t);
|
|
1739
1759
|
this.dragState.liveReorderIndex !== c && (this.updateHeaderDragPlaceholderPosition(i, c), this.dragState.liveReorderIndex = c), this.hideDropIndicator();
|
|
@@ -1777,10 +1797,10 @@ class L extends G {
|
|
|
1777
1797
|
i.offsetWidth - r
|
|
1778
1798
|
);
|
|
1779
1799
|
n.setAttribute("data-hidden", "");
|
|
1780
|
-
const
|
|
1781
|
-
c.setAttribute("slot", `${
|
|
1800
|
+
const a = "__dock-placeholder__", c = this.documentRef.createElement("span");
|
|
1801
|
+
c.setAttribute("slot", `${a}-header`), c.classList.add("dock-tab"), c.dataset.placeholder = "true", c.dataset.tabId = a, c.setAttribute("aria-hidden", "true"), c.textContent = i.textContent, c.style.display = "inline-block", c.style.minWidth = `${d}px`, c.style.opacity = "0.5";
|
|
1782
1802
|
const l = this.documentRef.createElement("div");
|
|
1783
|
-
l.setAttribute("slot", `${
|
|
1803
|
+
l.setAttribute("slot", `${a}-content`), l.classList.add("dock-stack__pane"), l.dataset.placeholder = "true", t.insertBefore(c, i), t.insertBefore(l, n), this.dragState && (this.dragState.placeholderHeader = t, this.dragState.placeholderEl = c);
|
|
1784
1804
|
}
|
|
1785
1805
|
// Move the placeholder to the computed target index within the strip.
|
|
1786
1806
|
// We reorder light-DOM children (header span + matching content div); the
|
|
@@ -1795,10 +1815,10 @@ class L extends G {
|
|
|
1795
1815
|
(c) => c !== i && (!n || c.dataset.pane !== n)
|
|
1796
1816
|
), r = Math.max(0, Math.min(e, o.length)), d = o[r] ?? null;
|
|
1797
1817
|
t.insertBefore(i, d);
|
|
1798
|
-
const
|
|
1818
|
+
const a = t.querySelector(
|
|
1799
1819
|
':scope > .dock-stack__pane[data-placeholder="true"]'
|
|
1800
1820
|
);
|
|
1801
|
-
|
|
1821
|
+
a && i.nextElementSibling !== a && t.insertBefore(a, i.nextElementSibling);
|
|
1802
1822
|
}
|
|
1803
1823
|
// Remove placeholder and restore the dragged tab's visibility.
|
|
1804
1824
|
clearHeaderDragPlaceholder() {
|
|
@@ -1850,8 +1870,8 @@ class L extends G {
|
|
|
1850
1870
|
const n = this.resolveStackLocation(i.sourcePath);
|
|
1851
1871
|
if (!n)
|
|
1852
1872
|
return;
|
|
1853
|
-
const o = i.pane, r = i.sourceStackEl ?? null, d = this.getBoundingClientRect(),
|
|
1854
|
-
{ left: m, top:
|
|
1873
|
+
const o = i.pane, r = i.sourceStackEl ?? null, d = this.getBoundingClientRect(), a = r?.getBoundingClientRect() ?? null, c = this.pendingTabDragMetrics, l = 320, h = 240, u = c && Number.isFinite(c.width) && c.width > 0 ? c.width : a && Number.isFinite(a.width) ? a.width : l, f = c && Number.isFinite(c.height) && c.height > 0 ? c.height : a && Number.isFinite(a.height) ? a.height : h, p = 1, m = c && Number.isFinite(c.left) ? c.left - p : Number.isFinite(t) ? t - d.left - u / 2 : 0, g = c && Number.isFinite(c.top) ? c.top - p : Number.isFinite(e) ? e - d.top - f / 2 : 0, y = R(
|
|
1874
|
+
{ left: m, top: g, width: u, height: f },
|
|
1855
1875
|
this.getHostSize()
|
|
1856
1876
|
), b = Number.isFinite(t) ? t - d.left - y.left : y.width / 2, k = Number.isFinite(e) ? e - d.top - y.top : y.height / 2;
|
|
1857
1877
|
this.removePaneFromLocation(n, o);
|
|
@@ -1898,24 +1918,24 @@ class L extends G {
|
|
|
1898
1918
|
const o = t.querySelector(
|
|
1899
1919
|
':scope > .dock-tab[data-placeholder="true"]'
|
|
1900
1920
|
)?.dataset.tabId, r = o ? i.find((m) => m.id === `${o}-header-button`) ?? null : null, d = this.dragState?.pane ?? null;
|
|
1901
|
-
let
|
|
1921
|
+
let a = null;
|
|
1902
1922
|
if (d) {
|
|
1903
1923
|
for (const m of Array.from(t.children))
|
|
1904
1924
|
if (m instanceof HTMLElement && m.classList.contains("dock-tab") && !m.hasAttribute("data-placeholder") && m.dataset.pane === d) {
|
|
1905
|
-
|
|
1925
|
+
a = m.dataset.tabId ?? null;
|
|
1906
1926
|
break;
|
|
1907
1927
|
}
|
|
1908
1928
|
}
|
|
1909
|
-
const c =
|
|
1929
|
+
const c = a ? i.find((m) => m.id === `${a}-header-button`) ?? null : null, l = i.filter(
|
|
1910
1930
|
(m) => m !== r && m !== c
|
|
1911
1931
|
);
|
|
1912
1932
|
if (l.length === 0)
|
|
1913
1933
|
return 0;
|
|
1914
|
-
const
|
|
1915
|
-
const
|
|
1916
|
-
return
|
|
1934
|
+
const h = r ? r.getBoundingClientRect() : null, f = !!h && Number.isFinite(h.width) && h.width > 0 && h ? h.left + h.width / 2 : null, p = l.map((m) => {
|
|
1935
|
+
const g = m.getBoundingClientRect();
|
|
1936
|
+
return g.left + g.width / 2;
|
|
1917
1937
|
});
|
|
1918
|
-
return
|
|
1938
|
+
return yt(p, e, f);
|
|
1919
1939
|
}
|
|
1920
1940
|
reorderPaneInLocationAtIndex(t, e, i) {
|
|
1921
1941
|
const n = t.node.panes, o = n.indexOf(e);
|
|
@@ -1931,16 +1951,16 @@ class L extends G {
|
|
|
1931
1951
|
finalizeDropFromPoint(t, e) {
|
|
1932
1952
|
if (!this.dragState)
|
|
1933
1953
|
return;
|
|
1934
|
-
const i = this.findStackAtPoint(t, e), n = i ? S(i.dataset.path) : null, o = this.dropJoystick.dataset.visible === "true", r = S(this.dropJoystick.dataset.path), d = this.dropJoystickTarget,
|
|
1935
|
-
if (this.dragState && this.dragState.floatingIndex !== null && this.dragState.floatingIndex < 0 && i && c && n &&
|
|
1936
|
-
const
|
|
1937
|
-
if (
|
|
1938
|
-
const
|
|
1939
|
-
this.reorderPaneInLocationAtIndex(
|
|
1954
|
+
const i = this.findStackAtPoint(t, e), n = i ? S(i.dataset.path) : null, o = this.dropJoystick.dataset.visible === "true", r = S(this.dropJoystick.dataset.path), d = this.dropJoystickTarget, a = d ? S(d.dataset.path) : null, c = (o ? r ?? a : null) ?? n, l = this.dropJoystick.dataset.zone, h = this.isDropZone(l) ? l : i ? this.computeDropZone(i, { clientX: t, clientY: e }, null) : null;
|
|
1955
|
+
if (this.dragState && this.dragState.floatingIndex !== null && this.dragState.floatingIndex < 0 && i && c && n && B(n, this.dragState.sourcePath) && (!h || h === "center")) {
|
|
1956
|
+
const u = this.resolveStackLocation(c);
|
|
1957
|
+
if (u) {
|
|
1958
|
+
const f = this.computeHeaderInsertIndex(i, t);
|
|
1959
|
+
this.reorderPaneInLocationAtIndex(u, this.dragState.pane, f), this.renderLayout(), this.dispatchLayoutChanged(), this.dragState.dropHandled = !0;
|
|
1940
1960
|
return;
|
|
1941
1961
|
}
|
|
1942
1962
|
}
|
|
1943
|
-
c && this.isDropZone(
|
|
1963
|
+
c && this.isDropZone(h) && (this.handleDrop(c, h), this.dragState.dropHandled = !0);
|
|
1944
1964
|
}
|
|
1945
1965
|
clearPendingDragEndTimeout() {
|
|
1946
1966
|
if (this.pendingDragEndTimeout !== null) {
|
|
@@ -1968,17 +1988,17 @@ class L extends G {
|
|
|
1968
1988
|
if (!o)
|
|
1969
1989
|
return;
|
|
1970
1990
|
this.removePaneFromLocation(o, i, !0);
|
|
1971
|
-
const
|
|
1991
|
+
const a = {
|
|
1972
1992
|
kind: "stack",
|
|
1973
1993
|
panes: [i],
|
|
1974
1994
|
activePane: i
|
|
1975
1995
|
};
|
|
1976
|
-
this.rootLayout =
|
|
1996
|
+
this.rootLayout = a, this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), this.dragState && (this.dragState.dropHandled = !0);
|
|
1977
1997
|
return;
|
|
1978
1998
|
}
|
|
1979
1999
|
if (!o || !r)
|
|
1980
2000
|
return;
|
|
1981
|
-
if (e === "center" &&
|
|
2001
|
+
if (e === "center" && B(n, t)) {
|
|
1982
2002
|
if (!o.node.panes.includes(i))
|
|
1983
2003
|
return;
|
|
1984
2004
|
this.reorderPaneInLocation(o, i), this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), this.dragState && (this.dragState.dropHandled = !0);
|
|
@@ -1994,14 +2014,14 @@ class L extends G {
|
|
|
1994
2014
|
activePane: i
|
|
1995
2015
|
};
|
|
1996
2016
|
if (r.context === "docked")
|
|
1997
|
-
this.rootLayout =
|
|
2017
|
+
this.rootLayout = _(this.rootLayout, r.node, d, e);
|
|
1998
2018
|
else {
|
|
1999
|
-
const
|
|
2000
|
-
if (!
|
|
2019
|
+
const a = this.floatingLayouts[r.index];
|
|
2020
|
+
if (!a) {
|
|
2001
2021
|
this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged();
|
|
2002
2022
|
return;
|
|
2003
2023
|
}
|
|
2004
|
-
|
|
2024
|
+
a.root = _(a.root, r.node, d, e), a.activePane = i;
|
|
2005
2025
|
}
|
|
2006
2026
|
this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), this.dragState && (this.dragState.dropHandled = !0);
|
|
2007
2027
|
}
|
|
@@ -2011,24 +2031,24 @@ class L extends G {
|
|
|
2011
2031
|
return !1;
|
|
2012
2032
|
const o = this.resolveStackLocation(e);
|
|
2013
2033
|
if (!o && e.type === "docked" && !this.rootLayout)
|
|
2014
|
-
return this.rootLayout =
|
|
2034
|
+
return this.rootLayout = F(n.root), this.removeFloatingAt(t), this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), !0;
|
|
2015
2035
|
if (!o || o.context === "floating" && o.index === t)
|
|
2016
2036
|
return !1;
|
|
2017
2037
|
if (i === "center") {
|
|
2018
2038
|
const r = I(n.root);
|
|
2019
2039
|
if (r.length === 0)
|
|
2020
2040
|
return !1;
|
|
2021
|
-
r.forEach((
|
|
2022
|
-
this.addPaneToLocation(o,
|
|
2041
|
+
r.forEach((a) => {
|
|
2042
|
+
this.addPaneToLocation(o, a);
|
|
2023
2043
|
});
|
|
2024
2044
|
const d = n.activePane && r.includes(n.activePane) ? n.activePane : E(n.root) ?? r[0];
|
|
2025
2045
|
return d && this.setActivePaneForLocation(o, d), this.removeFloatingAt(t), this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), !0;
|
|
2026
2046
|
}
|
|
2027
2047
|
if (o.context === "floating") {
|
|
2028
2048
|
const r = this.floatingLayouts[o.index];
|
|
2029
|
-
return r ? (r.root =
|
|
2049
|
+
return r ? (r.root = _(r.root, o.node, n.root, i), r.activePane = n.activePane ?? E(n.root) ?? void 0, this.removeFloatingAt(t), this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), !0) : !1;
|
|
2030
2050
|
}
|
|
2031
|
-
return this.rootLayout =
|
|
2051
|
+
return this.rootLayout = _(this.rootLayout, o.node, n.root, i), this.removeFloatingAt(t), this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), !0;
|
|
2032
2052
|
}
|
|
2033
2053
|
computeDropZone(t, e, i) {
|
|
2034
2054
|
const n = this.isDropZone(i) ? i : null;
|
|
@@ -2102,36 +2122,36 @@ class L extends G {
|
|
|
2102
2122
|
}
|
|
2103
2123
|
showDropIndicator(t, e) {
|
|
2104
2124
|
const i = S(t.dataset.path), n = this.dragState?.sourcePath ?? null;
|
|
2105
|
-
if (i && n &&
|
|
2125
|
+
if (i && n && bt(i, n))
|
|
2106
2126
|
return;
|
|
2107
|
-
const o = t.getBoundingClientRect(), r = this.getBoundingClientRect(), d = this.dropIndicator,
|
|
2108
|
-
|
|
2127
|
+
const o = t.getBoundingClientRect(), r = this.getBoundingClientRect(), d = this.dropIndicator, a = this.dropJoystick;
|
|
2128
|
+
a.hidden = !1;
|
|
2109
2129
|
const c = S(t.dataset.path);
|
|
2110
2130
|
let l = 100;
|
|
2111
|
-
c && c.type === "floating" && (l =
|
|
2112
|
-
let
|
|
2131
|
+
c && c.type === "floating" && (l = H(this.floatingLayouts[c.index], c.index) + 100), d.style.zIndex = String(l), a.style.zIndex = String(l + 1);
|
|
2132
|
+
let h = o.left - r.left, u = o.top - r.top, f = o.width, p = o.height;
|
|
2113
2133
|
const m = 0.5;
|
|
2114
2134
|
if (e) {
|
|
2115
2135
|
switch (e) {
|
|
2116
2136
|
case "left":
|
|
2117
|
-
|
|
2137
|
+
f = o.width * m;
|
|
2118
2138
|
break;
|
|
2119
2139
|
case "right":
|
|
2120
|
-
|
|
2140
|
+
f = o.width * m, h += o.width * (1 - m);
|
|
2121
2141
|
break;
|
|
2122
2142
|
case "top":
|
|
2123
|
-
|
|
2143
|
+
p = o.height * m;
|
|
2124
2144
|
break;
|
|
2125
2145
|
case "bottom":
|
|
2126
|
-
|
|
2146
|
+
p = o.height * m, u += o.height * (1 - m);
|
|
2127
2147
|
break;
|
|
2128
2148
|
}
|
|
2129
|
-
d.style.left = `${
|
|
2149
|
+
d.style.left = `${h}px`, d.style.top = `${u}px`, d.style.width = `${f}px`, d.style.height = `${p}px`, d.dataset.visible = "true";
|
|
2130
2150
|
} else
|
|
2131
2151
|
d.dataset.visible = "false";
|
|
2132
|
-
|
|
2133
|
-
const
|
|
2134
|
-
this.dropJoystickTarget = t,
|
|
2152
|
+
a.style.left = `${o.left - r.left + o.width / 2}px`, a.style.top = `${o.top - r.top + o.height / 2}px`, a.dataset.visible = "true", this.dropJoystick.style.display = "grid", a.dataset.path = t.dataset.path ?? "";
|
|
2153
|
+
const g = this.dropJoystickTarget && this.dropJoystickTarget !== t;
|
|
2154
|
+
this.dropJoystickTarget = t, g && delete this.dropJoystick.dataset.zone;
|
|
2135
2155
|
const y = !this.rootLayout && (t === this.dockedEl || i && i.type === "docked" && i.segments.length === 0), b = Array.from(this.dropJoystick.querySelectorAll(".dock-drop-joystick__spacer"));
|
|
2136
2156
|
y ? (b.forEach((k) => {
|
|
2137
2157
|
k.style.display = "";
|
|
@@ -2186,32 +2206,6 @@ class L extends G {
|
|
|
2186
2206
|
this.dispatchLayoutChanged();
|
|
2187
2207
|
}
|
|
2188
2208
|
}
|
|
2189
|
-
resolveSplitNode(t) {
|
|
2190
|
-
if (t.type === "docked") {
|
|
2191
|
-
const n = T(this.rootLayout, t.segments);
|
|
2192
|
-
return n && n.kind === "split" ? n : null;
|
|
2193
|
-
}
|
|
2194
|
-
const e = this.floatingLayouts[t.index];
|
|
2195
|
-
if (!e || !e.root)
|
|
2196
|
-
return null;
|
|
2197
|
-
const i = T(e.root, t.segments);
|
|
2198
|
-
return i && i.kind === "split" ? i : null;
|
|
2199
|
-
}
|
|
2200
|
-
normalizeFloatingLayout(t) {
|
|
2201
|
-
const e = t.bounds ?? { left: 0, top: 0, width: 320, height: 200 }, i = {
|
|
2202
|
-
left: Number.isFinite(e.left) ? e.left : 0,
|
|
2203
|
-
top: Number.isFinite(e.top) ? e.top : 0,
|
|
2204
|
-
width: Number.isFinite(e.width) ? Math.max(e.width, 160) : 320,
|
|
2205
|
-
height: Number.isFinite(e.height) ? Math.max(e.height, 120) : 200
|
|
2206
|
-
}, n = t.root ? _(t.root) : null;
|
|
2207
|
-
return {
|
|
2208
|
-
id: t.id,
|
|
2209
|
-
bounds: i,
|
|
2210
|
-
zIndex: t.zIndex,
|
|
2211
|
-
root: n,
|
|
2212
|
-
activePane: t.activePane
|
|
2213
|
-
};
|
|
2214
|
-
}
|
|
2215
2209
|
// Layer identity of a splitter in the rendered shadow tree. Splitters inside
|
|
2216
2210
|
// floating pane N are nested under `.dock-floating[data-path="f:N"]`;
|
|
2217
2211
|
// docked-layer splitters have no such ancestor. Two splitters share a layer
|
|
@@ -2222,29 +2216,20 @@ class L extends G {
|
|
|
2222
2216
|
const e = t.closest(".dock-floating");
|
|
2223
2217
|
return e ? e.dataset.path ?? "f:?" : "d";
|
|
2224
2218
|
}
|
|
2225
|
-
clonePath(t) {
|
|
2226
|
-
return t.type === "floating" ? { type: "floating", index: t.index, segments: [...t.segments] } : { type: "docked", segments: [...t.segments] };
|
|
2227
|
-
}
|
|
2228
|
-
isOrIsAncestorOf(t, e) {
|
|
2229
|
-
return t.type !== e.type || t.type === "floating" && e.index !== t.index || t.segments.length > e.segments.length ? !1 : t.segments.every((i, n) => i === e.segments[n]);
|
|
2230
|
-
}
|
|
2231
|
-
countPanesInTree(t) {
|
|
2232
|
-
return t ? t.kind === "stack" ? t.panes.length : t.children.reduce((e, i) => e + this.countPanesInTree(i), 0) : 0;
|
|
2233
|
-
}
|
|
2234
2219
|
resolveStackLocation(t) {
|
|
2235
2220
|
if (t.type === "floating") {
|
|
2236
2221
|
const i = this.floatingLayouts[t.index];
|
|
2237
2222
|
if (!i || !i.root)
|
|
2238
2223
|
return null;
|
|
2239
|
-
const n =
|
|
2224
|
+
const n = M(i.root, t.segments);
|
|
2240
2225
|
return !n || n.kind !== "stack" ? null : { context: "floating", index: t.index, path: [...t.segments], node: n };
|
|
2241
2226
|
}
|
|
2242
|
-
const e =
|
|
2227
|
+
const e = M(this.rootLayout, t.segments);
|
|
2243
2228
|
return !e || e.kind !== "stack" ? null : { context: "docked", path: [...t.segments], node: e };
|
|
2244
2229
|
}
|
|
2245
2230
|
removePaneFromLocation(t, e, i = !1) {
|
|
2246
2231
|
if (t.context === "docked") {
|
|
2247
|
-
const n =
|
|
2232
|
+
const n = ht(t.node, e);
|
|
2248
2233
|
return n && !i && this.normalizeAllLayouts(), n;
|
|
2249
2234
|
}
|
|
2250
2235
|
return this.removePaneFromFloating(t.index, t.path, e, i);
|
|
@@ -2354,7 +2339,7 @@ class L extends G {
|
|
|
2354
2339
|
*/
|
|
2355
2340
|
buildPaneMoveCandidates() {
|
|
2356
2341
|
const t = this.paneMoveMode ? w(this.paneMoveMode.sourcePath) : null, e = [];
|
|
2357
|
-
return
|
|
2342
|
+
return N(this.rootLayout, (i, n) => {
|
|
2358
2343
|
const o = w({ type: "docked", segments: n });
|
|
2359
2344
|
o !== t && e.push({
|
|
2360
2345
|
pathStr: o,
|
|
@@ -2433,7 +2418,7 @@ class L extends G {
|
|
|
2433
2418
|
synthesiseDragStateForKeyboardMove() {
|
|
2434
2419
|
this.paneMoveMode && (this.dragState = {
|
|
2435
2420
|
pane: this.paneMoveMode.paneName,
|
|
2436
|
-
sourcePath:
|
|
2421
|
+
sourcePath: T(this.paneMoveMode.sourcePath),
|
|
2437
2422
|
floatingIndex: this.paneMoveMode.sourcePath.type === "floating" ? this.paneMoveMode.sourcePath.index : null,
|
|
2438
2423
|
pointerOffsetX: 0,
|
|
2439
2424
|
pointerOffsetY: 0,
|
|
@@ -2499,7 +2484,7 @@ class L extends G {
|
|
|
2499
2484
|
const o = this.floatingLayouts[t];
|
|
2500
2485
|
if (!o || !o.root)
|
|
2501
2486
|
return !1;
|
|
2502
|
-
const r =
|
|
2487
|
+
const r = M(o.root, e);
|
|
2503
2488
|
if (!r || r.kind !== "stack")
|
|
2504
2489
|
return !1;
|
|
2505
2490
|
if (r.panes = r.panes.filter((d) => d !== i), r.panes.includes(r.activePane ?? "") || (r.panes.length > 0 ? r.activePane = r.panes[0] : delete r.activePane), o.activePane === i) {
|
|
@@ -2516,8 +2501,8 @@ class L extends G {
|
|
|
2516
2501
|
* pane removal) so the tree the renderer sees is always in canonical form.
|
|
2517
2502
|
*/
|
|
2518
2503
|
normalizeAllLayouts() {
|
|
2519
|
-
this.rootLayout =
|
|
2520
|
-
if (t.root =
|
|
2504
|
+
this.rootLayout = $(this.rootLayout), this.floatingLayouts = this.floatingLayouts.map((t) => {
|
|
2505
|
+
if (t.root = $(t.root), !t.root) return null;
|
|
2521
2506
|
const e = I(t.root);
|
|
2522
2507
|
if (!t.activePane || !e.includes(t.activePane)) {
|
|
2523
2508
|
const i = E(t.root);
|
|
@@ -2562,8 +2547,8 @@ class L extends G {
|
|
|
2562
2547
|
return JSON.parse(JSON.stringify(t));
|
|
2563
2548
|
}
|
|
2564
2549
|
}
|
|
2565
|
-
const
|
|
2566
|
-
typeof customElements < "u" && !customElements.get(
|
|
2550
|
+
const K = "mint-dock-manager";
|
|
2551
|
+
typeof customElements < "u" && !customElements.get(K) && customElements.define(K, L);
|
|
2567
2552
|
export {
|
|
2568
2553
|
L as MintDockManagerElement
|
|
2569
2554
|
};
|