@mintplayer/web-components 2.2.0 → 2.3.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/a11y/index.mjs +26 -2
- package/a11y/src/dismiss-stack.d.ts +25 -0
- package/a11y/src/error-text.d.ts +41 -0
- package/a11y/src/focus-restore.d.ts +116 -0
- package/a11y/src/focus-trap.d.ts +69 -0
- package/a11y/src/form-associated.d.ts +48 -0
- package/a11y/src/host-aria.d.ts +154 -0
- package/a11y/src/index.d.ts +16 -0
- package/a11y/src/inert-regions.d.ts +52 -0
- package/a11y/src/live-announcer.d.ts +8 -0
- package/a11y/src/roving-focus.d.ts +118 -0
- package/a11y/src/testing/expect-idref-resolves.d.ts +31 -0
- package/a11y/src/testing/index.d.ts +1 -0
- package/accordion/index.mjs +180 -174
- package/accordion/src/components/mp-accordion.d.ts +18 -13
- package/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +2 -0
- package/carousel/index.mjs +211 -164
- package/carousel/src/components/mp-carousel.d.ts +1 -0
- package/checkbox/index.mjs +1 -1
- package/checkbox/src/components/mp-checkbox.d.ts +59 -1
- package/chunks/focus-restore-DxuP1Oe2.mjs +94 -0
- package/chunks/focus-trap-DTOLJ5bb.mjs +121 -0
- package/chunks/form-associated-axmc5sY0.mjs +58 -0
- package/chunks/host-aria-WSGs7SPQ.mjs +152 -0
- package/chunks/inert-regions-DXCnn1LN.mjs +48 -0
- package/chunks/invalid-feedback.styles-he0JYrJm.mjs +11 -0
- package/chunks/{live-announcer-CZDTKulf.mjs → live-announcer-Bi0orG4n.mjs} +9 -9
- package/chunks/{mp-calendar.element-UC68iDbi.mjs → mp-calendar.element-u6uS31_j.mjs} +136 -105
- package/chunks/mp-checkbox-Ph2mMRGz.mjs +312 -0
- package/chunks/{mp-datatable-Bfw0KGkV.mjs → mp-datatable-BwTlh9A_.mjs} +265 -103
- package/chunks/{mp-pagination-BGxsawFL.mjs → mp-pagination-Dea75mD4.mjs} +25 -22
- package/chunks/mp-radio-BjW1HNSc.mjs +300 -0
- package/chunks/{mp-select-BDS1-YGn.mjs → mp-select-Ctu-v1-p.mjs} +163 -40
- package/chunks/{mp-splitter-C8cGCmac.mjs → mp-splitter-LszuRDbR.mjs} +53 -46
- package/chunks/{mp-tab-page-D1b4x-y2.mjs → mp-tab-page-CaCzX1ym.mjs} +46 -45
- package/chunks/{mp-timepicker.element-BwEiwX92.mjs → mp-timepicker.element-Bz393NDQ.mjs} +93 -86
- package/chunks/{mp-toggle-button-dLZNDUVz.mjs → mp-toggle-button-Kz6sIgBJ.mjs} +131 -37
- package/chunks/{mp-treeview-C48F63xb.mjs → mp-treeview-tkWu28iF.mjs} +67 -43
- package/chunks/overlay-controller-DPt13i8p.mjs +314 -0
- package/chunks/roving-focus-CrL9982a.mjs +129 -0
- package/code-snippet/index.mjs +21 -13
- package/code-snippet/src/mp-code-snippet.element.d.ts +6 -0
- package/datatable/index.mjs +1 -1
- package/datatable/src/components/mp-datatable.d.ts +50 -0
- package/datatable/src/types/index.d.ts +2 -0
- package/datatable/src/types/labels.d.ts +30 -0
- package/datepicker/index.mjs +45 -22
- package/datepicker/src/mp-datepicker.element.d.ts +30 -0
- package/datetime-picker/index.mjs +15 -9
- package/dock/index.mjs +365 -209
- package/dock/src/components/mint-dock-manager.element.d.ts +63 -3
- package/dropdown-menu/index.mjs +135 -90
- package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +12 -3
- package/file-manager/index.mjs +279 -214
- package/file-manager/src/components/mp-file-manager.d.ts +22 -0
- package/file-manager/src/types/messages.d.ts +9 -0
- package/multi-range/index.mjs +26 -10
- package/multi-range/src/mint-multi-range.element.d.ts +7 -0
- package/navbar/index.mjs +53 -39
- package/navbar/src/components/mp-navbar.d.ts +1 -0
- package/otp-input/index.mjs +82 -48
- package/otp-input/src/mint-otp-input.element.d.ts +31 -3
- package/overlay/index.mjs +2 -258
- package/overlay/src/overlay-controller.d.ts +64 -4
- package/package.json +9 -1
- package/pagination/index.mjs +1 -1
- package/query-builder/index.mjs +117 -87
- package/query-builder/src/model/messages.d.ts +9 -0
- package/radio/index.mjs +2 -160
- package/radio/src/components/mp-radio.d.ts +58 -3
- package/radio-group/index.d.ts +1 -0
- package/radio-group/index.mjs +145 -0
- package/radio-group/src/components/mp-radio-group.d.ts +52 -0
- package/radio-group/src/index.d.ts +1 -0
- package/radio-group/src/styles/radio-group.styles.d.ts +2 -0
- package/ribbon/index.mjs +316 -304
- package/ribbon/src/mp-ribbon.element.d.ts +16 -0
- package/scheduler/index.mjs +219 -132
- package/scheduler/src/components/mp-scheduler.d.ts +3 -0
- package/scheduler/src/views/base-view.d.ts +23 -0
- package/select/index.mjs +1 -1
- package/select/src/components/mp-select.d.ts +60 -3
- package/shell/index.mjs +142 -31
- package/shell/src/components/mp-shell.d.ts +1 -0
- package/signature-pad/index.d.ts +1 -0
- package/signature-pad/index.mjs +230 -0
- package/signature-pad/src/index.d.ts +2 -0
- package/signature-pad/src/mp-signature-pad.element.d.ts +143 -0
- package/signature-pad/src/mp-signature-pad.element.template.d.ts +2 -0
- package/signature-pad/src/types/signature.d.ts +12 -0
- package/splitter/index.mjs +1 -1
- package/splitter/src/components/mp-splitter.d.ts +7 -0
- package/tab-control/index.mjs +1 -1
- package/tile-manager/index.mjs +110 -93
- package/timeline/index.mjs +138 -54
- package/timeline/src/components/mp-timeline.d.ts +15 -0
- package/timepicker/index.mjs +1 -1
- package/timepicker/src/mp-time-list.element.d.ts +13 -4
- package/timepicker/src/mp-timepicker.element.d.ts +29 -0
- package/toggle-button/index.mjs +1 -1
- package/toggle-button/src/components/mp-toggle-button.d.ts +32 -1
- package/tree-select/index.mjs +233 -121
- package/tree-select/src/components/mp-tree-select.d.ts +37 -0
- package/treeview/index.mjs +1 -1
- package/treeview/src/components/mp-treeview.d.ts +10 -1
- package/chunks/mp-checkbox-BokLL7BS.mjs +0 -211
package/dock/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { html as D, unsafeCSS as E, LitElement as
|
|
2
|
-
import "../chunks/mp-tab-page-
|
|
3
|
-
import "../chunks/mp-splitter-
|
|
4
|
-
import { L as
|
|
1
|
+
import { html as D, unsafeCSS as E, LitElement as A } from "lit";
|
|
2
|
+
import "../chunks/mp-tab-page-CaCzX1ym.mjs";
|
|
3
|
+
import "../chunks/mp-splitter-LszuRDbR.mjs";
|
|
4
|
+
import { L as M } from "../chunks/live-announcer-Bi0orG4n.mjs";
|
|
5
|
+
import { F as C } from "../chunks/focus-restore-DxuP1Oe2.mjs";
|
|
5
6
|
const I = D`<div class="dock-root">
|
|
6
7
|
<div class="dock-docked"></div>
|
|
7
8
|
<div class="dock-floating-layer"></div>
|
|
@@ -53,7 +54,7 @@ const I = D`<div class="dock-root">
|
|
|
53
54
|
↓
|
|
54
55
|
</button>
|
|
55
56
|
<div class="dock-drop-joystick__spacer"></div>
|
|
56
|
-
</div>`,
|
|
57
|
+
</div>`, _ = E(`:host {
|
|
57
58
|
display: block;
|
|
58
59
|
position: relative;
|
|
59
60
|
width: 100%;
|
|
@@ -426,18 +427,21 @@ const I = D`<div class="dock-root">
|
|
|
426
427
|
animation: none !important;
|
|
427
428
|
}
|
|
428
429
|
}`);
|
|
429
|
-
class
|
|
430
|
+
class P extends A {
|
|
430
431
|
constructor() {
|
|
431
|
-
super(), this.liveAnnouncer = new
|
|
432
|
+
super(), this.liveAnnouncer = new M(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.showSnapMarkers = !1, this.debugLayoutIntegrity = !1, this.pendingDragEndTimeout = null, this.previousSplitSizes = /* @__PURE__ */ new Map(), this.layoutFocusRestore = new C(() => this.shadowRoot, {
|
|
433
|
+
selector: ".dock-intersection-handle[data-key], mp-tab-control, .dock-tab[data-tab-id]",
|
|
434
|
+
keyOf: (t) => t.dataset.key ?? t.dataset.tabId ?? (t.id || null)
|
|
435
|
+
}), this.instanceId = `mint-dock-${++P.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);
|
|
432
436
|
}
|
|
433
437
|
static {
|
|
434
|
-
this.styles = [
|
|
438
|
+
this.styles = [_];
|
|
435
439
|
}
|
|
436
440
|
static {
|
|
437
441
|
this.documentRef = typeof document < "u" ? document : null;
|
|
438
442
|
}
|
|
439
443
|
static configureDocument(t) {
|
|
440
|
-
t && (
|
|
444
|
+
t && (P.documentRef = t);
|
|
441
445
|
}
|
|
442
446
|
static get observedAttributes() {
|
|
443
447
|
return [...super.observedAttributes ?? [], "layout", "debug-layout-integrity"];
|
|
@@ -454,6 +458,9 @@ class v extends _ {
|
|
|
454
458
|
static {
|
|
455
459
|
this.TOUCH_PRESS_FEEDBACK_DELAY_MS = 150;
|
|
456
460
|
}
|
|
461
|
+
static {
|
|
462
|
+
this.PANE_MOVE_ZONE_ORDER = ["top", "right", "bottom", "left"];
|
|
463
|
+
}
|
|
457
464
|
renderSnapMarkersForCorner() {
|
|
458
465
|
if (!this.showSnapMarkers) return;
|
|
459
466
|
const t = this.shadowRoot?.querySelector(".dock-intersections-layer, .dock-intersection-layer");
|
|
@@ -508,12 +515,12 @@ class v extends _ {
|
|
|
508
515
|
);
|
|
509
516
|
if (l.length === 0)
|
|
510
517
|
throw new Error("mint-dock-manager template is missing drop joystick buttons.");
|
|
511
|
-
this.rootEl = i, this.dockedEl = o, this.floatingLayerEl = n, this.dropIndicator = r, this.dropJoystick = c, this.dropJoystickButtons = l, this.dockedEl.dataset.path = this.formatPath({ type: "docked", segments: [] }), i.addEventListener("keydown", (s) => this.onRootKeyDown(s), { capture: !0 }), this.renderLayout(), this.rootResizeObserver = new ResizeObserver(() => {
|
|
518
|
+
this.rootEl = i, this.dockedEl = o, this.floatingLayerEl = n, this.dropIndicator = r, this.dropJoystick = c, this.dropJoystickButtons = l, this.dockedEl.dataset.path = this.formatPath({ type: "docked", segments: [] }), i.addEventListener("keydown", (s) => this.onRootKeyDown(s), { capture: !0 }), i.addEventListener("focusout", (s) => this.onRootFocusOut(s)), this.renderLayout(), this.rootResizeObserver = new ResizeObserver(() => {
|
|
512
519
|
this.scheduleRenderIntersectionHandles(), this.updateFloatingPanePositions();
|
|
513
520
|
}), 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);
|
|
514
521
|
}
|
|
515
522
|
connectedCallback() {
|
|
516
|
-
super.connectedCallback(), this.hasAttribute("role") || this.setAttribute("role", "
|
|
523
|
+
super.connectedCallback(), this.hasAttribute("role") || this.setAttribute("role", "region"), this.hasAttribute("aria-label") || this.setAttribute("aria-label", "Dock layout");
|
|
517
524
|
}
|
|
518
525
|
disconnectedCallback() {
|
|
519
526
|
const t = this.windowRef;
|
|
@@ -555,10 +562,10 @@ class v extends _ {
|
|
|
555
562
|
return this.snapshot;
|
|
556
563
|
}
|
|
557
564
|
resolveDocument() {
|
|
558
|
-
const t =
|
|
565
|
+
const t = P.documentRef, e = this.ownerDocument ?? null, o = t ?? e ?? (typeof document < "u" ? document : null);
|
|
559
566
|
if (!o)
|
|
560
567
|
throw new Error("mint-dock-manager requires a Document to initialize.");
|
|
561
|
-
return
|
|
568
|
+
return P.documentRef || (P.documentRef = o), o;
|
|
562
569
|
}
|
|
563
570
|
resolveWindow(t) {
|
|
564
571
|
return typeof window < "u" ? window : t.defaultView ?? null;
|
|
@@ -585,11 +592,11 @@ class v extends _ {
|
|
|
585
592
|
}
|
|
586
593
|
renderLayout() {
|
|
587
594
|
if (this.dockedEl) {
|
|
588
|
-
if (this.dockedEl.innerHTML = "", this.floatingLayerEl.innerHTML = "", this.hideDropIndicator(), this.rootLayout) {
|
|
595
|
+
if (this.layoutFocusRestore.capture(), this.dockedEl.innerHTML = "", this.floatingLayerEl.innerHTML = "", this.hideDropIndicator(), this.rootLayout) {
|
|
589
596
|
const t = this.renderNode(this.rootLayout, []);
|
|
590
597
|
this.dockedEl.appendChild(t);
|
|
591
598
|
}
|
|
592
|
-
this.renderFloatingPanes(), this.verifyProjectionSlots();
|
|
599
|
+
this.renderFloatingPanes(), this.layoutFocusRestore.restore(), this.verifyProjectionSlots();
|
|
593
600
|
}
|
|
594
601
|
}
|
|
595
602
|
renderNode(t, e, i) {
|
|
@@ -609,30 +616,30 @@ class v extends _ {
|
|
|
609
616
|
o.setAttribute("role", "dialog"), o.setAttribute("aria-labelledby", r), o.setAttribute("aria-modal", "false");
|
|
610
617
|
const { left: c, top: l, width: s, height: a } = this.clampBoundsToHost(e.bounds, t);
|
|
611
618
|
o.style.left = `${c}px`, o.style.top = `${l}px`, o.style.width = `${s}px`, o.style.height = `${a}px`, o.style.minWidth = "0", o.style.minHeight = "0";
|
|
612
|
-
const
|
|
613
|
-
o.style.zIndex = String(
|
|
614
|
-
const
|
|
615
|
-
|
|
619
|
+
const p = this.getFloatingPaneZIndex(i);
|
|
620
|
+
o.style.zIndex = String(p);
|
|
621
|
+
const h = this.documentRef.createElement("div");
|
|
622
|
+
h.classList.add("dock-floating__chrome"), h.addEventListener(
|
|
616
623
|
"pointerdown",
|
|
617
|
-
(
|
|
624
|
+
(u) => this.beginFloatingDrag(u, i, o, h)
|
|
618
625
|
);
|
|
619
626
|
const d = this.documentRef.createElement("div");
|
|
620
|
-
d.classList.add("dock-floating__title"), d.id = r, d.textContent = n,
|
|
627
|
+
d.classList.add("dock-floating__title"), d.id = r, d.textContent = n, h.appendChild(d);
|
|
621
628
|
const g = this.documentRef.createElement("button");
|
|
622
|
-
if (g.type = "button", g.classList.add("dock-floating__close"), g.setAttribute("aria-label", `Close pane: ${n}`), g.textContent = "×", g.addEventListener("click", (
|
|
623
|
-
|
|
624
|
-
}), g.addEventListener("pointerdown", (
|
|
625
|
-
const
|
|
626
|
-
|
|
629
|
+
if (g.type = "button", g.classList.add("dock-floating__close"), g.setAttribute("aria-label", `Close pane: ${n}`), g.textContent = "×", g.addEventListener("click", (u) => {
|
|
630
|
+
u.stopPropagation(), this.closeFloatingPane(i);
|
|
631
|
+
}), g.addEventListener("pointerdown", (u) => u.stopPropagation()), h.appendChild(g), o.appendChild(h), e.root) {
|
|
632
|
+
const u = this.renderNode(e.root, [], i);
|
|
633
|
+
u.classList.add("dock-floating__stack"), o.appendChild(u);
|
|
627
634
|
} else {
|
|
628
|
-
const
|
|
629
|
-
|
|
635
|
+
const u = this.documentRef.createElement("div");
|
|
636
|
+
u.classList.add("dock-stack"), u.dataset.path = this.formatPath({
|
|
630
637
|
type: "floating",
|
|
631
638
|
index: i,
|
|
632
639
|
segments: []
|
|
633
640
|
});
|
|
634
641
|
const m = this.documentRef.createElement("div");
|
|
635
|
-
m.classList.add("dock-stack__pane"), m.textContent = "No panes configured",
|
|
642
|
+
m.classList.add("dock-stack__pane"), m.textContent = "No panes configured", u.appendChild(m), o.appendChild(u);
|
|
636
643
|
}
|
|
637
644
|
[
|
|
638
645
|
{
|
|
@@ -667,9 +674,9 @@ class v extends _ {
|
|
|
667
674
|
classes: ["dock-floating__resizer", "dock-floating__resizer--left"],
|
|
668
675
|
edges: { horizontal: "left", vertical: "none" }
|
|
669
676
|
}
|
|
670
|
-
].forEach(({ classes:
|
|
677
|
+
].forEach(({ classes: u, edges: m }) => {
|
|
671
678
|
const y = this.documentRef.createElement("div");
|
|
672
|
-
y.classList.add(...
|
|
679
|
+
y.classList.add(...u), y.setAttribute("role", "separator");
|
|
673
680
|
const b = m.horizontal === "none" && m.vertical !== "none", z = m.vertical === "none" && m.horizontal !== "none";
|
|
674
681
|
b ? y.setAttribute("aria-orientation", "horizontal") : z && y.setAttribute("aria-orientation", "vertical");
|
|
675
682
|
const S = [];
|
|
@@ -678,7 +685,10 @@ class v extends _ {
|
|
|
678
685
|
`Resize pane ${S.length === 2 ? "corner " : "edge "}${S.join("-")}`
|
|
679
686
|
), y.addEventListener(
|
|
680
687
|
"pointerdown",
|
|
681
|
-
(
|
|
688
|
+
(v) => this.beginFloatingResize(v, i, o, y, m)
|
|
689
|
+
), y.setAttribute("tabindex", "0"), y.setAttribute("aria-valuemin", "0"), y.setAttribute("aria-valuemax", "100"), this.syncFloatingResizerValue(y, i, m), y.addEventListener(
|
|
690
|
+
"keydown",
|
|
691
|
+
(v) => this.onFloatingResizeKeydown(v, i, o, y, m)
|
|
682
692
|
), o.appendChild(y);
|
|
683
693
|
}), this.floatingLayerEl.appendChild(o);
|
|
684
694
|
});
|
|
@@ -698,9 +708,9 @@ class v extends _ {
|
|
|
698
708
|
if (!t) return;
|
|
699
709
|
const e = this.rootEl.getBoundingClientRect();
|
|
700
710
|
if (this.cornerResizeState) {
|
|
701
|
-
const l = this.cornerResizeState, s = l.hs[0], a = l.vs[0],
|
|
711
|
+
const l = this.cornerResizeState, s = l.hs[0], a = l.vs[0], p = this.findSplitterByPath(s.path.segments), h = this.findSplitterByPath(a.path.segments), d = p ? this.getSplitterDividers(p)[s.index] : null, g = h ? this.getSplitterDividers(h)[a.index] : null;
|
|
702
712
|
if (d && g) {
|
|
703
|
-
const f = d.getBoundingClientRect(),
|
|
713
|
+
const f = d.getBoundingClientRect(), u = g.getBoundingClientRect(), m = u.left + u.width / 2 - e.left, y = f.top + f.height / 2 - e.top;
|
|
704
714
|
l.handle.style.left = `${m}px`, l.handle.style.top = `${y}px`, Array.from(t.querySelectorAll(".dock-intersection-handle")).forEach((b) => {
|
|
705
715
|
b !== l.handle && b.remove();
|
|
706
716
|
});
|
|
@@ -712,9 +722,9 @@ class v extends _ {
|
|
|
712
722
|
Array.from(
|
|
713
723
|
this.shadowRoot?.querySelectorAll(".dock-split") ?? []
|
|
714
724
|
).forEach((l) => {
|
|
715
|
-
const s = l.dataset.direction, a = l.dataset.path ?? "",
|
|
716
|
-
this.getSplitterDividers(l).forEach((
|
|
717
|
-
const g = { rect:
|
|
725
|
+
const s = l.dataset.direction, a = l.dataset.path ?? "", p = this.splitterLayerKey(l);
|
|
726
|
+
this.getSplitterDividers(l).forEach((h, d) => {
|
|
727
|
+
const g = { rect: h.getBoundingClientRect(), pathStr: a, index: d, layerKey: p };
|
|
718
728
|
s === "horizontal" ? o.push(g) : s === "vertical" && i.push(g);
|
|
719
729
|
});
|
|
720
730
|
});
|
|
@@ -723,18 +733,20 @@ class v extends _ {
|
|
|
723
733
|
const s = l.rect.top + l.rect.height / 2;
|
|
724
734
|
o.forEach((a) => {
|
|
725
735
|
if (l.layerKey !== a.layerKey) return;
|
|
726
|
-
const
|
|
727
|
-
if (
|
|
728
|
-
const g =
|
|
729
|
-
m.pairs.push({ h: { pathStr: l.pathStr, index: l.index }, v: { pathStr: a.pathStr, index: a.index } }), c.set(
|
|
736
|
+
const p = a.rect.left + a.rect.width / 2, h = p < l.rect.left ? l.rect.left - p : p > l.rect.right ? p - l.rect.right : 0, d = s < a.rect.top ? a.rect.top - s : s > a.rect.bottom ? s - a.rect.bottom : 0;
|
|
737
|
+
if (h > r || d > r) return;
|
|
738
|
+
const g = p - e.left, f = s - e.top, u = `${Math.round(g)}:${Math.round(f)}`, m = c.get(u) ?? { x: g, y: f, pairs: [] };
|
|
739
|
+
m.pairs.push({ h: { pathStr: l.pathStr, index: l.index }, v: { pathStr: a.pathStr, index: a.index } }), c.set(u, m);
|
|
730
740
|
});
|
|
731
741
|
}), c.forEach((l, s) => {
|
|
732
742
|
const a = this.documentRef.createElement("div");
|
|
733
|
-
a.classList.add("dock-intersection-handle", "glyph"), a.setAttribute("role", "separator"), a.setAttribute("aria-label", "Resize split intersection")
|
|
734
|
-
const
|
|
735
|
-
a.
|
|
736
|
-
const d = {
|
|
737
|
-
a.
|
|
743
|
+
a.classList.add("dock-intersection-handle", "glyph"), a.setAttribute("role", "separator"), a.setAttribute("aria-label", "Resize split intersection");
|
|
744
|
+
const p = e.width > 0 ? Math.round(l.x / e.width * 100) : 0;
|
|
745
|
+
a.setAttribute("aria-valuemin", "0"), a.setAttribute("aria-valuemax", "100"), a.setAttribute("aria-valuenow", String(Math.min(100, Math.max(0, p)))), a.setAttribute("tabindex", "0");
|
|
746
|
+
const h = l.pairs[0], d = `${h.h.pathStr}:${h.h.index}|${h.v.pathStr}:${h.v.index}`;
|
|
747
|
+
a.dataset.key = d, a.dataset.pairs = JSON.stringify(l.pairs), a.style.left = `${l.x}px`, a.style.top = `${l.y}px`;
|
|
748
|
+
const g = { path: this.parsePath(h.h.pathStr), index: h.h.index, container: this.findSplitterByPath(this.parsePath(h.h.pathStr)?.segments ?? []) ?? this.rootEl, rect: new DOMRect() }, f = { path: this.parsePath(h.v.pathStr), index: h.v.index, container: this.findSplitterByPath(this.parsePath(h.v.pathStr)?.segments ?? []) ?? this.rootEl, rect: new DOMRect() };
|
|
749
|
+
a.addEventListener("pointerdown", (u) => this.beginCornerResize(u, g, f, a)), a.addEventListener("dblclick", (u) => this.onIntersectionDoubleClick(u, a)), a.addEventListener("keydown", (u) => this.onIntersectionKeyDown(u, a)), t.appendChild(a);
|
|
738
750
|
});
|
|
739
751
|
}
|
|
740
752
|
/**
|
|
@@ -761,20 +773,20 @@ class v extends _ {
|
|
|
761
773
|
}
|
|
762
774
|
if (c.length === 0) return;
|
|
763
775
|
t.preventDefault();
|
|
764
|
-
const l = t.shiftKey, a = i || n ? c[0].v : c[0].h,
|
|
765
|
-
this.findSplitterByPath(
|
|
776
|
+
const l = t.shiftKey, a = i || n ? c[0].v : c[0].h, p = this.parsePath(a.pathStr);
|
|
777
|
+
this.findSplitterByPath(p?.segments ?? [])?.resizeDividerBy?.(a.index, t.key, l);
|
|
766
778
|
}
|
|
767
779
|
beginCornerResize(t, e, i, o) {
|
|
768
780
|
t.preventDefault();
|
|
769
|
-
const n = o.dataset.pairs, r = n ? JSON.parse(n) : [], c = [], l = [], s = (a,
|
|
781
|
+
const n = o.dataset.pairs, r = n ? JSON.parse(n) : [], c = [], l = [], s = (a, p, h) => {
|
|
770
782
|
const d = this.parsePath(a);
|
|
771
783
|
if (!d) return;
|
|
772
784
|
const g = this.findSplitterByPath(d.segments);
|
|
773
785
|
if (!g) return;
|
|
774
786
|
const f = this.getSplitterPanels(g);
|
|
775
787
|
if (f.length === 0) return;
|
|
776
|
-
const
|
|
777
|
-
|
|
788
|
+
const u = h === "h" ? "height" : "width", m = f.map((b) => b.getBoundingClientRect()[u]), y = { path: d, index: p, container: g, initialSizes: m, before: m[p], after: m[p + 1] };
|
|
789
|
+
h === "h" ? c.push(y) : l.push(y);
|
|
778
790
|
};
|
|
779
791
|
if (r.length > 0 ? r.forEach((a) => {
|
|
780
792
|
s(a.h.pathStr, a.h.index, "h"), s(a.v.pathStr, a.v.index, "v");
|
|
@@ -791,23 +803,23 @@ class v extends _ {
|
|
|
791
803
|
}, this.startPointerTracking(), o.dataset.key || (o.dataset.key = o.dataset.group ?? ""), this.renderSnapMarkersForCorner();
|
|
792
804
|
try {
|
|
793
805
|
const a = this.rootEl.getBoundingClientRect();
|
|
794
|
-
let
|
|
806
|
+
let p = null, h = null;
|
|
795
807
|
if (l.length > 0) {
|
|
796
|
-
const
|
|
797
|
-
y && (
|
|
808
|
+
const u = l[0], y = this.getSplitterDividers(u.container)[u.index]?.getBoundingClientRect();
|
|
809
|
+
y && (p = y.left + y.width / 2);
|
|
798
810
|
}
|
|
799
811
|
if (c.length > 0) {
|
|
800
|
-
const
|
|
801
|
-
y && (
|
|
812
|
+
const u = c[0], y = this.getSplitterDividers(u.container)[u.index]?.getBoundingClientRect();
|
|
813
|
+
y && (h = y.top + y.height / 2);
|
|
802
814
|
}
|
|
803
815
|
const d = [], g = [];
|
|
804
816
|
Array.from(
|
|
805
817
|
this.shadowRoot?.querySelectorAll(".dock-split") ?? []
|
|
806
|
-
).forEach((
|
|
807
|
-
const m =
|
|
808
|
-
this.getSplitterDividers(
|
|
818
|
+
).forEach((u) => {
|
|
819
|
+
const m = u.dataset.direction ?? void 0;
|
|
820
|
+
this.getSplitterDividers(u).forEach((y) => {
|
|
809
821
|
const b = y.getBoundingClientRect();
|
|
810
|
-
m === "horizontal" &&
|
|
822
|
+
m === "horizontal" && h != null ? h >= b.top && h <= b.bottom && d.push(b.left + b.width / 2 - a.left) : m === "vertical" && p != null && p >= b.left && p <= b.right && g.push(b.top + b.height / 2 - a.top);
|
|
811
823
|
});
|
|
812
824
|
}), this.cornerSnapXTargets = d, this.cornerSnapYTargets = g;
|
|
813
825
|
} catch {
|
|
@@ -818,41 +830,41 @@ class v extends _ {
|
|
|
818
830
|
handleCornerResizeMove(t) {
|
|
819
831
|
const e = this.cornerResizeState;
|
|
820
832
|
if (!e || e.pointerId !== t.pointerId) return;
|
|
821
|
-
const i = (s, a,
|
|
822
|
-
if (!
|
|
823
|
-
const
|
|
824
|
-
let g =
|
|
825
|
-
for (let
|
|
826
|
-
const m = Math.abs(d - u
|
|
827
|
-
m < f && (f = m, g = u
|
|
833
|
+
const i = (s, a, p) => {
|
|
834
|
+
if (!p || a <= 0) return s;
|
|
835
|
+
const h = [1 / 3, 1 / 2, 2 / 3], d = s / a;
|
|
836
|
+
let g = h[0], f = Math.abs(d - g);
|
|
837
|
+
for (let u = 1; u < h.length; u++) {
|
|
838
|
+
const m = Math.abs(d - h[u]);
|
|
839
|
+
m < f && (f = m, g = h[u]);
|
|
828
840
|
}
|
|
829
841
|
return g * a;
|
|
830
842
|
}, o = 10, n = this.rootEl.getBoundingClientRect();
|
|
831
843
|
let r = t.clientX, c = t.clientY;
|
|
832
844
|
if (this.cornerSnapXTargets.length) {
|
|
833
845
|
let s = r, a = o + 1;
|
|
834
|
-
this.cornerSnapXTargets.forEach((
|
|
835
|
-
const
|
|
836
|
-
d < a && (a = d, s =
|
|
846
|
+
this.cornerSnapXTargets.forEach((p) => {
|
|
847
|
+
const h = n.left + p, d = Math.abs(h - r);
|
|
848
|
+
d < a && (a = d, s = h);
|
|
837
849
|
}), a <= o && (r = s);
|
|
838
850
|
}
|
|
839
851
|
if (this.cornerSnapYTargets.length) {
|
|
840
852
|
let s = c, a = o + 1;
|
|
841
|
-
this.cornerSnapYTargets.forEach((
|
|
842
|
-
const
|
|
843
|
-
d < a && (a = d, s =
|
|
853
|
+
this.cornerSnapYTargets.forEach((p) => {
|
|
854
|
+
const h = n.top + p, d = Math.abs(h - c);
|
|
855
|
+
d < a && (a = d, s = h);
|
|
844
856
|
}), a <= o && (c = s);
|
|
845
857
|
}
|
|
846
858
|
const l = (s, a) => {
|
|
847
|
-
const
|
|
848
|
-
if (!
|
|
849
|
-
const
|
|
850
|
-
let g = Math.min(Math.max(s.beforeSize + a,
|
|
859
|
+
const p = this.resolveSplitNode(s.path);
|
|
860
|
+
if (!p) return;
|
|
861
|
+
const h = 48, d = s.beforeSize + s.afterSize;
|
|
862
|
+
let g = Math.min(Math.max(s.beforeSize + a, h), d - h);
|
|
851
863
|
g = i(g, d, t.shiftKey);
|
|
852
|
-
const f = d - g,
|
|
853
|
-
|
|
854
|
-
const m =
|
|
855
|
-
|
|
864
|
+
const f = d - g, u = [...s.initialSizes];
|
|
865
|
+
u[s.index] = g, u[s.index + 1] = f;
|
|
866
|
+
const m = u.reduce((y, b) => y + b, 0);
|
|
867
|
+
p.sizes = m > 0 ? u.map((y) => y / m) : [], s.container.setPanelSizes?.(u);
|
|
856
868
|
};
|
|
857
869
|
e.hs.forEach((s) => l(s, c - s.startY)), e.vs.forEach((s) => l(s, r - s.startX)), this.dispatchLayoutChanged(), this.scheduleRenderIntersectionHandles();
|
|
858
870
|
}
|
|
@@ -872,10 +884,10 @@ class v extends _ {
|
|
|
872
884
|
if (!Array.isArray(o) || o.length === 0) {
|
|
873
885
|
const a = (e.dataset.key ?? "").split("|");
|
|
874
886
|
if (a.length === 2) {
|
|
875
|
-
const [
|
|
887
|
+
const [p, h] = a, d = p.lastIndexOf(":"), g = h.lastIndexOf(":");
|
|
876
888
|
if (d > 0 && g > 0) {
|
|
877
|
-
const f =
|
|
878
|
-
o.push({ h: { pathStr: f, index: m }, v: { pathStr:
|
|
889
|
+
const f = p.slice(0, d), u = h.slice(0, g), m = Number.parseInt(p.slice(d + 1), 10), y = Number.parseInt(h.slice(g + 1), 10);
|
|
890
|
+
o.push({ h: { pathStr: f, index: m }, v: { pathStr: u, index: y } });
|
|
879
891
|
}
|
|
880
892
|
}
|
|
881
893
|
}
|
|
@@ -889,45 +901,45 @@ class v extends _ {
|
|
|
889
901
|
this.previousSplitSizes.has(s) && (r = !0);
|
|
890
902
|
});
|
|
891
903
|
const c = (s, a) => {
|
|
892
|
-
const
|
|
893
|
-
if (!
|
|
894
|
-
const d = (
|
|
904
|
+
const p = this.findSplitterByPath(s.segments);
|
|
905
|
+
if (!p) return;
|
|
906
|
+
const d = (p.dataset.direction ?? "horizontal") === "horizontal" ? p.getBoundingClientRect().width : p.getBoundingClientRect().height;
|
|
895
907
|
if (!Number.isFinite(d) || d <= 0) return;
|
|
896
|
-
const g = a.reduce((
|
|
908
|
+
const g = a.reduce((u, m) => u + Math.max(m, 0), 0);
|
|
897
909
|
if (g <= 0) return;
|
|
898
|
-
const f = a.map((
|
|
899
|
-
|
|
900
|
-
}, l = (s, a,
|
|
901
|
-
const
|
|
902
|
-
if (!
|
|
903
|
-
const d = this.resolveSplitNode(
|
|
910
|
+
const f = a.map((u) => Math.max(u, 0) / g * d);
|
|
911
|
+
p.setPanelSizes?.(f);
|
|
912
|
+
}, l = (s, a, p) => {
|
|
913
|
+
const h = this.parsePath(s);
|
|
914
|
+
if (!h) return;
|
|
915
|
+
const d = this.resolveSplitNode(h);
|
|
904
916
|
if (!d) return;
|
|
905
|
-
const g = this.normalizeSizesArray(d.sizes ?? [], d.children.length), f =
|
|
906
|
-
d.sizes = f, c(
|
|
917
|
+
const g = this.normalizeSizesArray(d.sizes ?? [], d.children.length), f = p([...g], a);
|
|
918
|
+
d.sizes = f, c(h, f);
|
|
907
919
|
};
|
|
908
920
|
if (r)
|
|
909
921
|
this.previousSplitSizes.forEach((s, a) => {
|
|
910
|
-
const
|
|
911
|
-
if (!
|
|
912
|
-
const d = this.normalizeSizesArray(s,
|
|
913
|
-
|
|
922
|
+
const p = this.parsePath(a), h = p ? this.resolveSplitNode(p) : null;
|
|
923
|
+
if (!h || !p) return;
|
|
924
|
+
const d = this.normalizeSizesArray(s, h.children.length);
|
|
925
|
+
h.sizes = d, c(p, d);
|
|
914
926
|
}), this.previousSplitSizes.clear();
|
|
915
927
|
else {
|
|
916
928
|
const s = /* @__PURE__ */ new Set();
|
|
917
929
|
o.forEach((a) => {
|
|
918
|
-
[a.h.pathStr, a.v.pathStr].forEach((
|
|
919
|
-
if (s.has(
|
|
920
|
-
const d = this.parsePath(
|
|
921
|
-
g && Array.isArray(g.sizes) && this.previousSplitSizes.set(
|
|
930
|
+
[a.h.pathStr, a.v.pathStr].forEach((h) => {
|
|
931
|
+
if (s.has(h)) return;
|
|
932
|
+
const d = this.parsePath(h), g = d ? this.resolveSplitNode(d) : null;
|
|
933
|
+
g && Array.isArray(g.sizes) && this.previousSplitSizes.set(h, [...g.sizes]), s.add(h);
|
|
922
934
|
});
|
|
923
|
-
const
|
|
924
|
-
const g = (
|
|
925
|
-
if (g <= 0) return
|
|
926
|
-
|
|
927
|
-
const f =
|
|
928
|
-
return f > 0 ?
|
|
935
|
+
const p = (h, d) => {
|
|
936
|
+
const g = (h[d] ?? 0) + (h[d + 1] ?? 0);
|
|
937
|
+
if (g <= 0) return h;
|
|
938
|
+
h[d] = g / 2, h[d + 1] = g / 2;
|
|
939
|
+
const f = h.reduce((u, m) => u + m, 0);
|
|
940
|
+
return f > 0 ? h.map((u) => u / f) : h;
|
|
929
941
|
};
|
|
930
|
-
l(a.h.pathStr, a.h.index,
|
|
942
|
+
l(a.h.pathStr, a.h.index, p), l(a.v.pathStr, a.v.index, p);
|
|
931
943
|
});
|
|
932
944
|
}
|
|
933
945
|
this.dispatchLayoutChanged(), this.scheduleRenderIntersectionHandles();
|
|
@@ -953,6 +965,40 @@ class v extends _ {
|
|
|
953
965
|
handle: o
|
|
954
966
|
}, this.startPointerTracking();
|
|
955
967
|
}
|
|
968
|
+
/** The percent-of-host size of the dimension a handle drives (width for
|
|
969
|
+
* horizontal/corner handles, height for pure-vertical ones). */
|
|
970
|
+
syncFloatingResizerValue(t, e, i) {
|
|
971
|
+
const o = this.floatingLayouts[e], n = this.getHostSize();
|
|
972
|
+
if (!o || n.width <= 0 || n.height <= 0) return;
|
|
973
|
+
const r = i.horizontal !== "none" ? o.bounds.width / n.width * 100 : o.bounds.height / n.height * 100;
|
|
974
|
+
t.setAttribute("aria-valuenow", String(Math.round(Math.min(100, Math.max(0, r)))));
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* Keyboard resize for floating panes — the same edge-anchored math as the
|
|
978
|
+
* pointer path (left/top handles move the edge outward, right/bottom grow),
|
|
979
|
+
* ±10px per arrow, Shift for 1px. Off-axis arrows and modifier chords pass
|
|
980
|
+
* through untouched.
|
|
981
|
+
*/
|
|
982
|
+
onFloatingResizeKeydown(t, e, i, o, n) {
|
|
983
|
+
if (t.altKey || t.ctrlKey || t.metaKey) return;
|
|
984
|
+
const r = t.key === "ArrowLeft" ? -1 : t.key === "ArrowRight" ? 1 : 0, c = t.key === "ArrowUp" ? -1 : t.key === "ArrowDown" ? 1 : 0;
|
|
985
|
+
if (r === 0 && c === 0 || r !== 0 && n.horizontal === "none" || c !== 0 && n.vertical === "none") return;
|
|
986
|
+
const l = this.floatingLayouts[e];
|
|
987
|
+
if (!l) return;
|
|
988
|
+
t.preventDefault(), t.stopPropagation();
|
|
989
|
+
const s = t.shiftKey ? 1 : 10, a = this.getHostSize(), p = a.width > 0 ? Math.min(192, a.width) : 192, h = a.height > 0 ? Math.min(128, a.height) : 128, d = { ...l.bounds };
|
|
990
|
+
if (r !== 0) {
|
|
991
|
+
const g = n.horizontal === "left" ? -r * s : r * s;
|
|
992
|
+
let f = Math.max(p, d.width + g);
|
|
993
|
+
n.horizontal === "left" ? (f = Math.min(f, d.left + d.width), d.left = d.left + d.width - f) : a.width > 0 && (f = Math.min(f, a.width - d.left)), d.width = f;
|
|
994
|
+
}
|
|
995
|
+
if (c !== 0) {
|
|
996
|
+
const g = n.vertical === "top" ? -c * s : c * s;
|
|
997
|
+
let f = Math.max(h, d.height + g);
|
|
998
|
+
n.vertical === "top" ? (f = Math.min(f, d.top + d.height), d.top = d.top + d.height - f) : a.height > 0 && (f = Math.min(f, a.height - d.top)), d.height = f;
|
|
999
|
+
}
|
|
1000
|
+
l.bounds = d, i.style.left = `${d.left}px`, i.style.top = `${d.top}px`, i.style.width = `${d.width}px`, i.style.height = `${d.height}px`, this.syncFloatingResizerValue(o, e, n), this.dispatchLayoutChanged();
|
|
1001
|
+
}
|
|
956
1002
|
beginFloatingResize(t, e, i, o, n) {
|
|
957
1003
|
const r = this.floatingLayouts[e];
|
|
958
1004
|
if (r) {
|
|
@@ -1028,10 +1074,10 @@ class v extends _ {
|
|
|
1028
1074
|
if (!e || t.pointerId !== e.pointerId)
|
|
1029
1075
|
return;
|
|
1030
1076
|
const i = t.clientX - e.startX, o = t.clientY - e.startY, n = this.getHostSize(), r = n.width > 0 ? Math.min(192, n.width) : 192, c = n.height > 0 ? Math.min(128, n.height) : 128;
|
|
1031
|
-
let l = e.startWidth, s = e.startHeight, a = e.startLeft,
|
|
1032
|
-
e.edges.horizontal === "right" ? (l = Math.max(r, e.startWidth + i), n.width > 0 && (l = Math.min(l, n.width - e.startLeft))) : e.edges.horizontal === "left" && (l = Math.max(r, e.startWidth - i), l = Math.min(l, e.startLeft + e.startWidth), a = e.startLeft + e.startWidth - l), e.edges.vertical === "bottom" ? (s = Math.max(c, e.startHeight + o), n.height > 0 && (s = Math.min(s, n.height - e.startTop))) : e.edges.vertical === "top" && (s = Math.max(c, e.startHeight - o), s = Math.min(s, e.startTop + e.startHeight),
|
|
1033
|
-
const
|
|
1034
|
-
|
|
1077
|
+
let l = e.startWidth, s = e.startHeight, a = e.startLeft, p = e.startTop;
|
|
1078
|
+
e.edges.horizontal === "right" ? (l = Math.max(r, e.startWidth + i), n.width > 0 && (l = Math.min(l, n.width - e.startLeft))) : e.edges.horizontal === "left" && (l = Math.max(r, e.startWidth - i), l = Math.min(l, e.startLeft + e.startWidth), a = e.startLeft + e.startWidth - l), e.edges.vertical === "bottom" ? (s = Math.max(c, e.startHeight + o), n.height > 0 && (s = Math.min(s, n.height - e.startTop))) : e.edges.vertical === "top" && (s = Math.max(c, e.startHeight - o), s = Math.min(s, e.startTop + e.startHeight), p = e.startTop + e.startHeight - s), e.wrapper.style.width = `${l}px`, e.wrapper.style.height = `${s}px`, e.wrapper.style.left = `${a}px`, e.wrapper.style.top = `${p}px`;
|
|
1079
|
+
const h = this.floatingLayouts[e.index];
|
|
1080
|
+
h && (h.bounds = { left: a, top: p, width: l, height: s });
|
|
1035
1081
|
}
|
|
1036
1082
|
endFloatingResize(t) {
|
|
1037
1083
|
const e = this.floatingResizeState;
|
|
@@ -1040,7 +1086,7 @@ class v extends _ {
|
|
|
1040
1086
|
e.handle.releasePointerCapture(e.pointerId);
|
|
1041
1087
|
} catch {
|
|
1042
1088
|
}
|
|
1043
|
-
delete e.handle.dataset.resizing, this.floatingResizeState = null, this.dispatchLayoutChanged();
|
|
1089
|
+
delete e.handle.dataset.resizing, this.syncFloatingResizerValue(e.handle, e.index, e.edges), this.floatingResizeState = null, this.dispatchLayoutChanged();
|
|
1044
1090
|
}
|
|
1045
1091
|
}
|
|
1046
1092
|
getFloatingPaneZIndex(t) {
|
|
@@ -1133,7 +1179,7 @@ class v extends _ {
|
|
|
1133
1179
|
});
|
|
1134
1180
|
const r = Array.isArray(t.sizes) ? t.sizes : [];
|
|
1135
1181
|
return r.length > 0 && requestAnimationFrame(() => {
|
|
1136
|
-
const c = r.reduce((a,
|
|
1182
|
+
const c = r.reduce((a, p) => a + Math.max(p, 0), 0);
|
|
1137
1183
|
if (c <= 0) return;
|
|
1138
1184
|
const l = t.direction === "horizontal" ? o.getBoundingClientRect().width : o.getBoundingClientRect().height;
|
|
1139
1185
|
if (!Number.isFinite(l) || l <= 0) return;
|
|
@@ -1148,9 +1194,9 @@ class v extends _ {
|
|
|
1148
1194
|
const a = (s.sizes ?? []).reduce(
|
|
1149
1195
|
(d, g) => d + Math.max(g, 0),
|
|
1150
1196
|
0
|
|
1151
|
-
),
|
|
1152
|
-
|
|
1153
|
-
(d) => Math.max(d, 0) /
|
|
1197
|
+
), p = l.sizes.reduce((d, g) => d + Math.max(g, 0), 0), h = a > 0 ? a : l.sizes.length;
|
|
1198
|
+
p > 0 && (s.sizes = l.sizes.map(
|
|
1199
|
+
(d) => Math.max(d, 0) / p * h
|
|
1154
1200
|
), this.dispatchLayoutChanged());
|
|
1155
1201
|
}), o;
|
|
1156
1202
|
}
|
|
@@ -1163,22 +1209,22 @@ class v extends _ {
|
|
|
1163
1209
|
if (r.length === 0) {
|
|
1164
1210
|
const a = this.documentRef.createElement("span");
|
|
1165
1211
|
a.setAttribute("slot", "__empty__-header"), a.textContent = "(empty)";
|
|
1166
|
-
const
|
|
1167
|
-
return
|
|
1212
|
+
const p = this.documentRef.createElement("div");
|
|
1213
|
+
return p.setAttribute("slot", "__empty__-content"), p.classList.add("dock-stack__pane"), p.textContent = "No panes configured", o.append(a, p), o.setAttribute("active-tab", "__empty__"), o;
|
|
1168
1214
|
}
|
|
1169
1215
|
const c = r.includes(t.activePane ?? "") ? t.activePane : r[0], l = e.length ? e.join("-") : "root", s = typeof i == "number" ? `f${i}-${l}` : l;
|
|
1170
1216
|
return r.forEach((a) => {
|
|
1171
|
-
const
|
|
1217
|
+
const p = a.replace(/[^a-zA-Z0-9_-]/g, "-"), h = p.length > 0 ? p : "pane", d = `${this.instanceId}-tab-${s}-${h}`, g = `${this.instanceId}-panel-${s}-${h}`, f = this.documentRef.createElement("span");
|
|
1172
1218
|
f.setAttribute("slot", `${d}-header`), f.classList.add("dock-tab"), f.dataset.pane = a, f.dataset.tabId = d, f.textContent = this.titles[a] ?? a, f.addEventListener("pointerdown", (y) => {
|
|
1173
1219
|
this.captureTabDragMetrics(y, o), this.armPaneDragGesture(y, this.clonePath(n), a, o), y.stopPropagation();
|
|
1174
1220
|
});
|
|
1175
|
-
const
|
|
1176
|
-
|
|
1221
|
+
const u = this.documentRef.createElement("div");
|
|
1222
|
+
u.setAttribute("slot", `${d}-content`), u.classList.add("dock-stack__pane"), u.dataset.pane = a, u.dataset.tabId = d, u.id = g;
|
|
1177
1223
|
const m = this.documentRef.createElement("slot");
|
|
1178
|
-
m.name = a,
|
|
1224
|
+
m.name = a, u.appendChild(m), o.append(f, u), a === c && o.setAttribute("active-tab", d);
|
|
1179
1225
|
}), o.dataset.activePane = c, o.addEventListener("tab-activate", (a) => {
|
|
1180
|
-
const
|
|
1181
|
-
`:scope > [data-tab-id="${
|
|
1226
|
+
const p = a.detail, d = o.querySelector(
|
|
1227
|
+
`:scope > [data-tab-id="${p.tabId}"]`
|
|
1182
1228
|
)?.dataset.pane;
|
|
1183
1229
|
d && (this.activatePane(o, d, this.clonePath(n)), this.dispatchEvent(
|
|
1184
1230
|
new CustomEvent("dock-pane-activated", {
|
|
@@ -1298,16 +1344,16 @@ class v extends _ {
|
|
|
1298
1344
|
if (!n) return;
|
|
1299
1345
|
const r = t.clientX, c = t.clientY, l = t.pointerId, s = 5;
|
|
1300
1346
|
let a = !1;
|
|
1301
|
-
const
|
|
1302
|
-
a = !0, n.removeEventListener("pointermove",
|
|
1303
|
-
},
|
|
1347
|
+
const p = () => {
|
|
1348
|
+
a = !0, n.removeEventListener("pointermove", h, !0), n.removeEventListener("pointerup", d, !0), n.removeEventListener("pointercancel", d, !0);
|
|
1349
|
+
}, h = (g) => {
|
|
1304
1350
|
if (a || g.pointerId !== l) return;
|
|
1305
|
-
const f = g.clientX - r,
|
|
1306
|
-
Math.hypot(f,
|
|
1351
|
+
const f = g.clientX - r, u = g.clientY - c;
|
|
1352
|
+
Math.hypot(f, u) < s || (p(), this.beginPaneDrag(g, e, i, o));
|
|
1307
1353
|
}, d = (g) => {
|
|
1308
|
-
a || g.pointerId !== l || (
|
|
1354
|
+
a || g.pointerId !== l || (p(), this.clearPendingTabDragMetrics());
|
|
1309
1355
|
};
|
|
1310
|
-
n.addEventListener("pointermove",
|
|
1356
|
+
n.addEventListener("pointermove", h, !0), n.addEventListener("pointerup", d, !0), n.addEventListener("pointercancel", d, !0);
|
|
1311
1357
|
}
|
|
1312
1358
|
/**
|
|
1313
1359
|
* Touch-specific gesture arming. With `.dock-tab` set to `touch-action:
|
|
@@ -1334,34 +1380,34 @@ class v extends _ {
|
|
|
1334
1380
|
const n = this.windowRef;
|
|
1335
1381
|
if (!n) return;
|
|
1336
1382
|
const r = t.clientX, c = t.clientY, l = t.pointerId;
|
|
1337
|
-
let s = r, a = c,
|
|
1338
|
-
const f = t.currentTarget instanceof HTMLElement ? t.currentTarget : t.target instanceof HTMLElement ? t.target.closest(".dock-tab") : null,
|
|
1383
|
+
let s = r, a = c, p = r, h = !1, d = !1, g = !1;
|
|
1384
|
+
const f = t.currentTarget instanceof HTMLElement ? t.currentTarget : t.target instanceof HTMLElement ? t.target.closest(".dock-tab") : null, u = o ? this.getStackStripEl(o)?.querySelector(
|
|
1339
1385
|
"ul.nav.nav-tabs"
|
|
1340
1386
|
) ?? null : null, m = () => {
|
|
1341
|
-
|
|
1387
|
+
h || (h = !0, n.clearTimeout(S), n.clearTimeout(v), n.removeEventListener("pointermove", y, !0), n.removeEventListener("pointerup", b, !0), n.removeEventListener("pointercancel", z, !0), g && f && f.removeAttribute("data-pressing"));
|
|
1342
1388
|
}, y = (k) => {
|
|
1343
|
-
if (
|
|
1389
|
+
if (h || k.pointerId !== l) return;
|
|
1344
1390
|
if (d) {
|
|
1345
|
-
const
|
|
1346
|
-
|
|
1391
|
+
const T = k.clientX - p;
|
|
1392
|
+
p = k.clientX, u && (u.scrollLeft -= T);
|
|
1347
1393
|
return;
|
|
1348
1394
|
}
|
|
1349
1395
|
s = k.clientX, a = k.clientY;
|
|
1350
|
-
const
|
|
1351
|
-
if (Math.hypot(
|
|
1396
|
+
const w = k.clientX - r, L = k.clientY - c;
|
|
1397
|
+
if (Math.hypot(w, L) <= P.TOUCH_LONG_PRESS_SLOP_PX)
|
|
1352
1398
|
return;
|
|
1353
|
-
const
|
|
1354
|
-
if (Math.abs(
|
|
1355
|
-
n.clearTimeout(S), n.clearTimeout(
|
|
1399
|
+
const R = !!u && u.scrollWidth > u.clientWidth;
|
|
1400
|
+
if (Math.abs(w) > Math.abs(L) && R) {
|
|
1401
|
+
n.clearTimeout(S), n.clearTimeout(v), g && f && (f.removeAttribute("data-pressing"), g = !1), d = !0, p = k.clientX, u.scrollLeft -= w, this.clearPendingTabDragMetrics();
|
|
1356
1402
|
return;
|
|
1357
1403
|
}
|
|
1358
1404
|
m(), this.clearPendingTabDragMetrics();
|
|
1359
1405
|
}, b = (k) => {
|
|
1360
|
-
|
|
1406
|
+
h || k.pointerId !== l || (m(), this.clearPendingTabDragMetrics());
|
|
1361
1407
|
}, z = (k) => {
|
|
1362
|
-
|
|
1408
|
+
h || k.pointerId !== l || (m(), this.clearPendingTabDragMetrics());
|
|
1363
1409
|
}, S = n.setTimeout(() => {
|
|
1364
|
-
if (
|
|
1410
|
+
if (h) return;
|
|
1365
1411
|
m();
|
|
1366
1412
|
try {
|
|
1367
1413
|
this.setPointerCapture(l);
|
|
@@ -1382,9 +1428,9 @@ class v extends _ {
|
|
|
1382
1428
|
cancelable: !1
|
|
1383
1429
|
});
|
|
1384
1430
|
this.beginPaneDrag(k, e, i, o);
|
|
1385
|
-
},
|
|
1386
|
-
|
|
1387
|
-
},
|
|
1431
|
+
}, P.TOUCH_LONG_PRESS_MS), v = n.setTimeout(() => {
|
|
1432
|
+
h || !f || (g = !0, f.setAttribute("data-pressing", "true"));
|
|
1433
|
+
}, P.TOUCH_PRESS_FEEDBACK_DELAY_MS);
|
|
1388
1434
|
n.addEventListener("pointermove", y, !0), n.addEventListener("pointerup", b, !0), n.addEventListener("pointercancel", z, !0);
|
|
1389
1435
|
}
|
|
1390
1436
|
beginPaneDrag(t, e, i, o) {
|
|
@@ -1393,7 +1439,7 @@ class v extends _ {
|
|
|
1393
1439
|
floatingIndex: r,
|
|
1394
1440
|
pointerOffsetX: c,
|
|
1395
1441
|
pointerOffsetY: l
|
|
1396
|
-
} = this.preparePaneDragSource(e, i, o, t), s = o ? this.getStackStripEl(o) : null, a = s ? s.getBoundingClientRect() : null,
|
|
1442
|
+
} = this.preparePaneDragSource(e, i, o, t), s = o ? this.getStackStripEl(o) : null, a = s ? s.getBoundingClientRect() : null, p = a ? { left: a.left, top: a.top, right: a.right, bottom: a.bottom } : null, h = this.pendingTabDragMetrics;
|
|
1397
1443
|
if (this.dragState = {
|
|
1398
1444
|
pane: i,
|
|
1399
1445
|
sourcePath: this.clonePath(n),
|
|
@@ -1402,9 +1448,9 @@ class v extends _ {
|
|
|
1402
1448
|
pointerOffsetY: l,
|
|
1403
1449
|
dropHandled: !1,
|
|
1404
1450
|
sourceStackEl: o,
|
|
1405
|
-
sourceHeaderBounds:
|
|
1406
|
-
startClientX:
|
|
1407
|
-
startClientY:
|
|
1451
|
+
sourceHeaderBounds: p,
|
|
1452
|
+
startClientX: h && Number.isFinite(h.startClientX) ? h.startClientX : t.clientX,
|
|
1453
|
+
startClientY: h && Number.isFinite(h.startClientY) ? h.startClientY : t.clientY
|
|
1408
1454
|
}, this.lastDragPointerPosition = {
|
|
1409
1455
|
x: this.dragState.startClientX,
|
|
1410
1456
|
y: this.dragState.startClientY
|
|
@@ -1439,11 +1485,11 @@ class v extends _ {
|
|
|
1439
1485
|
s.activePane = e, this.updateFloatingWindowTitle(n.index);
|
|
1440
1486
|
const g = this.getFloatingWrapper(n.index);
|
|
1441
1487
|
g && this.promoteFloatingPane(n.index, g);
|
|
1442
|
-
const f = this.getBoundingClientRect(),
|
|
1488
|
+
const f = this.getBoundingClientRect(), u = r && Number.isFinite(r.pointerOffsetX) && Number.isFinite(r.left) && Number.isFinite(s.bounds.left) ? r.pointerOffsetX + (r.left - s.bounds.left) : Number.isFinite(o.clientX) && Number.isFinite(s.bounds.left) ? o.clientX - f.left - s.bounds.left : s.bounds.width / 2, m = r && Number.isFinite(r.pointerOffsetY) && Number.isFinite(r.top) && Number.isFinite(s.bounds.top) ? r.pointerOffsetY + (r.top - s.bounds.top) : Number.isFinite(o.clientY) && Number.isFinite(s.bounds.top) ? o.clientY - f.top - s.bounds.top : s.bounds.height / 2;
|
|
1443
1489
|
return {
|
|
1444
1490
|
path: t,
|
|
1445
1491
|
floatingIndex: n.index,
|
|
1446
|
-
pointerOffsetX:
|
|
1492
|
+
pointerOffsetX: u,
|
|
1447
1493
|
pointerOffsetY: m
|
|
1448
1494
|
};
|
|
1449
1495
|
}
|
|
@@ -1454,11 +1500,11 @@ class v extends _ {
|
|
|
1454
1500
|
pointerOffsetY: 0
|
|
1455
1501
|
};
|
|
1456
1502
|
}
|
|
1457
|
-
const
|
|
1503
|
+
const h = r && Number.isFinite(r.pointerOffsetX) ? r.pointerOffsetX : 0, d = r && Number.isFinite(r.pointerOffsetY) ? r.pointerOffsetY : 0;
|
|
1458
1504
|
return {
|
|
1459
1505
|
path: t,
|
|
1460
1506
|
floatingIndex: -1,
|
|
1461
|
-
pointerOffsetX:
|
|
1507
|
+
pointerOffsetX: h,
|
|
1462
1508
|
pointerOffsetY: d
|
|
1463
1509
|
};
|
|
1464
1510
|
}
|
|
@@ -1471,10 +1517,10 @@ class v extends _ {
|
|
|
1471
1517
|
if (!this.dragState || !Number.isFinite(t) || !Number.isFinite(e))
|
|
1472
1518
|
return;
|
|
1473
1519
|
if (this.dragState.floatingIndex !== null && this.dragState.floatingIndex < 0) {
|
|
1474
|
-
const
|
|
1475
|
-
let
|
|
1476
|
-
const m =
|
|
1477
|
-
|
|
1520
|
+
const p = this.dragState.sourceHeaderBounds, h = this.dragState.startClientX ?? t, d = this.dragState.startClientY ?? e, g = Math.hypot(t - h, e - d), f = 8;
|
|
1521
|
+
let u = !0;
|
|
1522
|
+
const m = p ? this.isPointWithinBounds(p, t, e) : !0, y = this.isPointerOverSourceHeader(t, e);
|
|
1523
|
+
u = m || y, !u && g > f && this.convertPendingTabDragToFloating(t, e);
|
|
1478
1524
|
}
|
|
1479
1525
|
this.updatePaneDragDropTargetFromPoint(t, e);
|
|
1480
1526
|
const { floatingIndex: i, pointerOffsetX: o, pointerOffsetY: n } = this.dragState;
|
|
@@ -1618,8 +1664,8 @@ class v extends _ {
|
|
|
1618
1664
|
const o = this.resolveStackLocation(i.sourcePath);
|
|
1619
1665
|
if (!o)
|
|
1620
1666
|
return;
|
|
1621
|
-
const n = i.pane, r = i.sourceStackEl ?? null, c = this.getBoundingClientRect(), l = r?.getBoundingClientRect() ?? null, s = this.pendingTabDragMetrics, a = 320,
|
|
1622
|
-
{ left: f, top:
|
|
1667
|
+
const n = i.pane, r = i.sourceStackEl ?? null, c = this.getBoundingClientRect(), l = r?.getBoundingClientRect() ?? null, s = this.pendingTabDragMetrics, a = 320, p = 240, h = s && Number.isFinite(s.width) && s.width > 0 ? s.width : l && Number.isFinite(l.width) ? l.width : a, d = s && Number.isFinite(s.height) && s.height > 0 ? s.height : l && Number.isFinite(l.height) ? l.height : p, g = 1, f = s && Number.isFinite(s.left) ? s.left - g : Number.isFinite(t) ? t - c.left - h / 2 : 0, u = s && Number.isFinite(s.top) ? s.top - g : Number.isFinite(e) ? e - c.top - d / 2 : 0, m = this.clampBoundsToHost(
|
|
1668
|
+
{ left: f, top: u, width: h, height: d },
|
|
1623
1669
|
this.getHostSize()
|
|
1624
1670
|
), y = Number.isFinite(t) ? t - c.left - m.left : m.width / 2, b = Number.isFinite(e) ? e - c.top - m.top : m.height / 2;
|
|
1625
1671
|
this.removePaneFromLocation(o, n);
|
|
@@ -1633,10 +1679,10 @@ class v extends _ {
|
|
|
1633
1679
|
activePane: n
|
|
1634
1680
|
};
|
|
1635
1681
|
this.floatingLayouts.push(S);
|
|
1636
|
-
const
|
|
1682
|
+
const v = this.floatingLayouts.length - 1;
|
|
1637
1683
|
this.renderLayout();
|
|
1638
|
-
const k = this.getFloatingWrapper(
|
|
1639
|
-
k && this.promoteFloatingPane(
|
|
1684
|
+
const k = this.getFloatingWrapper(v);
|
|
1685
|
+
k && this.promoteFloatingPane(v, k), this.liveAnnouncer.announce(`Pane ${this.titles[n] ?? n} torn off into a floating window.`), i.sourcePath = { type: "floating", index: v, segments: [] }, i.floatingIndex = v, i.pointerOffsetX = y, i.pointerOffsetY = b, this.markDraggedFloatingWrapper(), this.dispatchLayoutChanged();
|
|
1640
1686
|
}
|
|
1641
1687
|
// Toggle data-dragging on the floating wrapper currently associated with
|
|
1642
1688
|
// the active pane drag (dragState.floatingIndex), if any. Used to make the
|
|
@@ -1665,25 +1711,25 @@ class v extends _ {
|
|
|
1665
1711
|
return 0;
|
|
1666
1712
|
const n = t.querySelector(
|
|
1667
1713
|
':scope > .dock-tab[data-placeholder="true"]'
|
|
1668
|
-
)?.dataset.tabId, r = n ? i.find((
|
|
1714
|
+
)?.dataset.tabId, r = n ? i.find((u) => u.id === `${n}-header-button`) ?? null : null, c = this.dragState?.pane ?? null;
|
|
1669
1715
|
let l = null;
|
|
1670
1716
|
if (c) {
|
|
1671
|
-
for (const
|
|
1672
|
-
if (
|
|
1673
|
-
l =
|
|
1717
|
+
for (const u of Array.from(t.children))
|
|
1718
|
+
if (u instanceof HTMLElement && u.classList.contains("dock-tab") && !u.hasAttribute("data-placeholder") && u.dataset.pane === c) {
|
|
1719
|
+
l = u.dataset.tabId ?? null;
|
|
1674
1720
|
break;
|
|
1675
1721
|
}
|
|
1676
1722
|
}
|
|
1677
|
-
const s = l ? i.find((
|
|
1678
|
-
(
|
|
1723
|
+
const s = l ? i.find((u) => u.id === `${l}-header-button`) ?? null : null, a = i.filter(
|
|
1724
|
+
(u) => u !== r && u !== s
|
|
1679
1725
|
);
|
|
1680
1726
|
if (a.length === 0)
|
|
1681
1727
|
return 0;
|
|
1682
|
-
const
|
|
1683
|
-
for (let
|
|
1684
|
-
const m = a[
|
|
1728
|
+
const p = 12, h = 0, d = r ? r.getBoundingClientRect() : null, f = !!d && Number.isFinite(d.width) && d.width > 0 && d ? d.left + d.width / 2 : null;
|
|
1729
|
+
for (let u = 0; u < a.length; u += 1) {
|
|
1730
|
+
const m = a[u].getBoundingClientRect(), y = m.left + m.width / 2, z = (f !== null ? y >= f : !1) ? y + p : y - h;
|
|
1685
1731
|
if (e < z)
|
|
1686
|
-
return
|
|
1732
|
+
return u;
|
|
1687
1733
|
}
|
|
1688
1734
|
return a.length;
|
|
1689
1735
|
}
|
|
@@ -1701,16 +1747,16 @@ class v extends _ {
|
|
|
1701
1747
|
finalizeDropFromPoint(t, e) {
|
|
1702
1748
|
if (!this.dragState)
|
|
1703
1749
|
return;
|
|
1704
|
-
const i = this.findStackAtPoint(t, e), o = i ? this.parsePath(i.dataset.path) : null, n = this.dropJoystick.dataset.visible === "true", r = this.parsePath(this.dropJoystick.dataset.path), c = this.dropJoystickTarget, l = c ? this.parsePath(c.dataset.path) : null, s = (n ? r ?? l : null) ?? o, a = this.dropJoystick.dataset.zone,
|
|
1705
|
-
if (this.dragState && this.dragState.floatingIndex !== null && this.dragState.floatingIndex < 0 && i && s && o && this.pathsEqual(o, this.dragState.sourcePath) && (!
|
|
1706
|
-
const
|
|
1707
|
-
if (
|
|
1750
|
+
const i = this.findStackAtPoint(t, e), o = i ? this.parsePath(i.dataset.path) : null, n = this.dropJoystick.dataset.visible === "true", r = this.parsePath(this.dropJoystick.dataset.path), c = this.dropJoystickTarget, l = c ? this.parsePath(c.dataset.path) : null, s = (n ? r ?? l : null) ?? o, a = this.dropJoystick.dataset.zone, p = this.isDropZone(a) ? a : i ? this.computeDropZone(i, { clientX: t, clientY: e }, null) : null;
|
|
1751
|
+
if (this.dragState && this.dragState.floatingIndex !== null && this.dragState.floatingIndex < 0 && i && s && o && this.pathsEqual(o, this.dragState.sourcePath) && (!p || p === "center")) {
|
|
1752
|
+
const h = this.resolveStackLocation(s);
|
|
1753
|
+
if (h) {
|
|
1708
1754
|
const d = this.computeHeaderInsertIndex(i, t);
|
|
1709
|
-
this.reorderPaneInLocationAtIndex(
|
|
1755
|
+
this.reorderPaneInLocationAtIndex(h, this.dragState.pane, d), this.renderLayout(), this.dispatchLayoutChanged(), this.dragState.dropHandled = !0;
|
|
1710
1756
|
return;
|
|
1711
1757
|
}
|
|
1712
1758
|
}
|
|
1713
|
-
s && this.isDropZone(
|
|
1759
|
+
s && this.isDropZone(p) && (this.handleDrop(s, p), this.dragState.dropHandled = !0);
|
|
1714
1760
|
}
|
|
1715
1761
|
clearPendingDragEndTimeout() {
|
|
1716
1762
|
if (this.pendingDragEndTimeout !== null) {
|
|
@@ -1906,7 +1952,7 @@ class v extends _ {
|
|
|
1906
1952
|
const s = this.parsePath(t.dataset.path);
|
|
1907
1953
|
let a = 100;
|
|
1908
1954
|
s && s.type === "floating" && (a = this.getFloatingPaneZIndex(s.index) + 100), c.style.zIndex = String(a), l.style.zIndex = String(a + 1);
|
|
1909
|
-
let
|
|
1955
|
+
let p = n.left - r.left, h = n.top - r.top, d = n.width, g = n.height;
|
|
1910
1956
|
const f = 0.5;
|
|
1911
1957
|
if (e) {
|
|
1912
1958
|
switch (e) {
|
|
@@ -1914,21 +1960,21 @@ class v extends _ {
|
|
|
1914
1960
|
d = n.width * f;
|
|
1915
1961
|
break;
|
|
1916
1962
|
case "right":
|
|
1917
|
-
d = n.width * f,
|
|
1963
|
+
d = n.width * f, p += n.width * (1 - f);
|
|
1918
1964
|
break;
|
|
1919
1965
|
case "top":
|
|
1920
1966
|
g = n.height * f;
|
|
1921
1967
|
break;
|
|
1922
1968
|
case "bottom":
|
|
1923
|
-
g = n.height * f,
|
|
1969
|
+
g = n.height * f, h += n.height * (1 - f);
|
|
1924
1970
|
break;
|
|
1925
1971
|
}
|
|
1926
|
-
c.style.left = `${
|
|
1972
|
+
c.style.left = `${p}px`, c.style.top = `${h}px`, c.style.width = `${d}px`, c.style.height = `${g}px`, c.dataset.visible = "true";
|
|
1927
1973
|
} else
|
|
1928
1974
|
c.dataset.visible = "false";
|
|
1929
1975
|
l.style.left = `${n.left - r.left + n.width / 2}px`, l.style.top = `${n.top - r.top + n.height / 2}px`, l.dataset.visible = "true", this.dropJoystick.style.display = "grid", l.dataset.path = t.dataset.path ?? "";
|
|
1930
|
-
const
|
|
1931
|
-
this.dropJoystickTarget = t,
|
|
1976
|
+
const u = this.dropJoystickTarget && this.dropJoystickTarget !== t;
|
|
1977
|
+
this.dropJoystickTarget = t, u && delete this.dropJoystick.dataset.zone;
|
|
1932
1978
|
const m = !this.rootLayout && (t === this.dockedEl || i && i.type === "docked" && i.segments.length === 0), y = Array.from(this.dropJoystick.querySelectorAll(".dock-drop-joystick__spacer"));
|
|
1933
1979
|
m ? (y.forEach((b) => {
|
|
1934
1980
|
b.style.display = "";
|
|
@@ -2170,35 +2216,136 @@ class v extends _ {
|
|
|
2170
2216
|
* Keyboard handler on the dock root, registered in capture phase so it
|
|
2171
2217
|
* runs before mp-tab-control's shadow-internal handlers swallow Arrow /
|
|
2172
2218
|
* Home / End / Enter. M opens move mode on a focused tab; subsequent
|
|
2173
|
-
* letter keys (T/R/B/L/F) commit the move
|
|
2219
|
+
* letter keys (T/R/B/L/F) commit the move, arrows cycle enumerated drop
|
|
2220
|
+
* targets and Enter commits the highlighted one; Escape cancels.
|
|
2174
2221
|
*/
|
|
2175
2222
|
onRootKeyDown(t) {
|
|
2176
2223
|
if (this.paneMoveMode) {
|
|
2177
2224
|
this.handlePaneMoveModeKey(t);
|
|
2178
2225
|
return;
|
|
2179
2226
|
}
|
|
2180
|
-
if (t.key !== "m" && t.key !== "M") return;
|
|
2227
|
+
if (t.altKey || t.ctrlKey || t.metaKey || t.key !== "m" && t.key !== "M") return;
|
|
2181
2228
|
const e = this.findFocusedPaneOrigin();
|
|
2182
2229
|
if (!e) return;
|
|
2183
|
-
t.preventDefault(), t.stopPropagation(), this.paneMoveMode = e;
|
|
2230
|
+
t.preventDefault(), t.stopPropagation(), this.paneMoveMode = e, this.paneMoveCandidateIndex = null;
|
|
2184
2231
|
const i = this.titles[e.paneName] ?? e.paneName;
|
|
2185
2232
|
this.liveAnnouncer.announce(
|
|
2186
|
-
`Move mode for pane ${i}. Press T, R, B, or L to dock to top, right, bottom, or left of the current stack
|
|
2233
|
+
`Move mode for pane ${i}. Press T, R, B, or L to dock to top, right, bottom, or left of the current stack, F to float, arrow keys to cycle drop targets, Enter to commit, Escape to cancel.`
|
|
2187
2234
|
);
|
|
2188
2235
|
}
|
|
2236
|
+
/**
|
|
2237
|
+
* Cancel move mode when focus leaves the dock entirely. Moves WITHIN the
|
|
2238
|
+
* dock (tab to tab, tab to pane content) keep it armed — the commit always
|
|
2239
|
+
* applies to the pane captured at arm time, which the announcement named.
|
|
2240
|
+
*/
|
|
2241
|
+
onRootFocusOut(t) {
|
|
2242
|
+
if (!this.paneMoveMode) return;
|
|
2243
|
+
const e = t.relatedTarget instanceof Node ? t.relatedTarget : null;
|
|
2244
|
+
e && this.isWithinDock(e) || (this.clearPaneMoveState(), this.liveAnnouncer.announce("Move cancelled."));
|
|
2245
|
+
}
|
|
2246
|
+
/** Composed-tree containment: true for shadow content AND slotted light DOM. */
|
|
2247
|
+
isWithinDock(t) {
|
|
2248
|
+
for (let e = t; e; ) {
|
|
2249
|
+
if (e === this) return !0;
|
|
2250
|
+
e = e instanceof ShadowRoot ? e.host : e.parentNode;
|
|
2251
|
+
}
|
|
2252
|
+
return !1;
|
|
2253
|
+
}
|
|
2189
2254
|
handlePaneMoveModeKey(t) {
|
|
2190
2255
|
if (t.key === "Escape") {
|
|
2191
|
-
t.preventDefault(), t.stopPropagation(), this.
|
|
2256
|
+
t.preventDefault(), t.stopPropagation(), this.clearPaneMoveState(), this.liveAnnouncer.announce("Move cancelled.");
|
|
2257
|
+
return;
|
|
2258
|
+
}
|
|
2259
|
+
const e = t.composedPath()[0];
|
|
2260
|
+
if (e instanceof HTMLElement && (e.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(e.tagName)))
|
|
2261
|
+
return;
|
|
2262
|
+
const o = {
|
|
2263
|
+
ArrowRight: 1,
|
|
2264
|
+
ArrowDown: 1,
|
|
2265
|
+
ArrowLeft: -1,
|
|
2266
|
+
ArrowUp: -1
|
|
2267
|
+
}[t.key];
|
|
2268
|
+
if (o) {
|
|
2269
|
+
t.preventDefault(), t.stopPropagation(), this.cyclePaneMoveCandidate(o);
|
|
2270
|
+
return;
|
|
2271
|
+
}
|
|
2272
|
+
if (t.key === "Enter") {
|
|
2273
|
+
if (this.paneMoveCandidateIndex === null) return;
|
|
2274
|
+
t.preventDefault(), t.stopPropagation(), this.commitHighlightedPaneMoveCandidate();
|
|
2192
2275
|
return;
|
|
2193
2276
|
}
|
|
2194
|
-
const
|
|
2277
|
+
const n = t.key.toLowerCase(), c = {
|
|
2195
2278
|
t: "top",
|
|
2196
2279
|
r: "right",
|
|
2197
2280
|
b: "bottom",
|
|
2198
2281
|
l: "left",
|
|
2199
2282
|
f: "float"
|
|
2200
|
-
}[
|
|
2201
|
-
|
|
2283
|
+
}[n];
|
|
2284
|
+
c && (t.preventDefault(), t.stopPropagation(), c === "float" ? this.commitPaneMoveAsFloat() : this.commitPaneMoveToZone(c));
|
|
2285
|
+
}
|
|
2286
|
+
/**
|
|
2287
|
+
* Enumerated keyboard drop targets, in cycle order: every docked leaf stack
|
|
2288
|
+
* except the one the moving pane currently sits in (T/R/B/L already split
|
|
2289
|
+
* that one), each contributing its four side zones, then a single `float`
|
|
2290
|
+
* candidate last. Rebuilt on every cycle step so it can never describe a
|
|
2291
|
+
* layout that has since changed.
|
|
2292
|
+
*
|
|
2293
|
+
* The identity carried forward is `data-path`, produced by the same
|
|
2294
|
+
* formatPath() that renderStack() stamps onto each `.dock-stack` and that the
|
|
2295
|
+
* pointer drop path parses back — which is what makes an enumerated commit
|
|
2296
|
+
* land exactly where a pointer drop on that stack would.
|
|
2297
|
+
*/
|
|
2298
|
+
buildPaneMoveCandidates() {
|
|
2299
|
+
const t = this.paneMoveMode ? this.formatPath(this.paneMoveMode.sourcePath) : null, e = [];
|
|
2300
|
+
return this.forEachStack(this.rootLayout, (i, o) => {
|
|
2301
|
+
const n = this.formatPath({ type: "docked", segments: o });
|
|
2302
|
+
n !== t && e.push({
|
|
2303
|
+
pathStr: n,
|
|
2304
|
+
targetTitles: i.panes.map((r) => this.titles[r] ?? r).join(", ")
|
|
2305
|
+
});
|
|
2306
|
+
}), [
|
|
2307
|
+
...e.flatMap(
|
|
2308
|
+
({ pathStr: i, targetTitles: o }) => P.PANE_MOVE_ZONE_ORDER.map((n) => ({ pathStr: i, zone: n, targetTitles: o }))
|
|
2309
|
+
),
|
|
2310
|
+
{ pathStr: null, zone: "float", targetTitles: "" }
|
|
2311
|
+
];
|
|
2312
|
+
}
|
|
2313
|
+
cyclePaneMoveCandidate(t) {
|
|
2314
|
+
const e = this.buildPaneMoveCandidates();
|
|
2315
|
+
if (e.length === 0) return;
|
|
2316
|
+
const i = this.paneMoveCandidateIndex, o = i === null ? t > 0 ? 0 : e.length - 1 : (i + t + e.length) % e.length;
|
|
2317
|
+
this.paneMoveCandidateIndex = o;
|
|
2318
|
+
const n = e[o];
|
|
2319
|
+
this.highlightPaneMoveCandidate(n);
|
|
2320
|
+
const r = n.zone === "float" ? "Float" : `${n.zone[0].toUpperCase()}${n.zone.slice(1)} of ${n.targetTitles}`;
|
|
2321
|
+
this.liveAnnouncer.announce(`${r}, option ${o + 1} of ${e.length}.`);
|
|
2322
|
+
}
|
|
2323
|
+
highlightPaneMoveCandidate(t) {
|
|
2324
|
+
if (this.hideDropIndicator(), t.zone === "float" || !t.pathStr) return;
|
|
2325
|
+
const e = this.shadowRoot?.querySelector(
|
|
2326
|
+
`.dock-stack[data-path="${t.pathStr}"]`
|
|
2327
|
+
);
|
|
2328
|
+
if (!e) return;
|
|
2329
|
+
const i = e.getBoundingClientRect();
|
|
2330
|
+
i.width === 0 || i.height === 0 || this.showDropIndicator(e, t.zone);
|
|
2331
|
+
}
|
|
2332
|
+
commitHighlightedPaneMoveCandidate() {
|
|
2333
|
+
const t = this.paneMoveCandidateIndex;
|
|
2334
|
+
if (t === null) return;
|
|
2335
|
+
const e = this.buildPaneMoveCandidates()[t];
|
|
2336
|
+
if (!e) {
|
|
2337
|
+
this.clearPaneMoveState();
|
|
2338
|
+
return;
|
|
2339
|
+
}
|
|
2340
|
+
if (e.zone === "float") {
|
|
2341
|
+
this.commitPaneMoveAsFloat();
|
|
2342
|
+
return;
|
|
2343
|
+
}
|
|
2344
|
+
this.commitPaneMoveToZone(e.zone, this.parsePath(e.pathStr));
|
|
2345
|
+
}
|
|
2346
|
+
/** Sole exit point for move mode: drops the arming AND any highlight together. */
|
|
2347
|
+
clearPaneMoveState() {
|
|
2348
|
+
this.paneMoveMode = null, this.paneMoveCandidateIndex !== null && (this.paneMoveCandidateIndex = null, this.hideDropIndicator());
|
|
2202
2349
|
}
|
|
2203
2350
|
/**
|
|
2204
2351
|
* Walk the focused element through nested shadow roots to find a focused
|
|
@@ -2240,18 +2387,27 @@ class v extends _ {
|
|
|
2240
2387
|
startClientY: 0
|
|
2241
2388
|
});
|
|
2242
2389
|
}
|
|
2243
|
-
|
|
2390
|
+
/**
|
|
2391
|
+
* `targetPath` omitted (the T/R/B/L keys) means the source stack is also the
|
|
2392
|
+
* target stack, and handleDrop creates a sibling split with the moved pane on
|
|
2393
|
+
* the chosen side. An enumerated candidate passes its own target instead.
|
|
2394
|
+
*/
|
|
2395
|
+
commitPaneMoveToZone(t, e) {
|
|
2244
2396
|
if (!this.paneMoveMode) return;
|
|
2245
|
-
const
|
|
2246
|
-
this.synthesiseDragStateForKeyboardMove(), this.handleDrop(e.sourcePath, t)
|
|
2247
|
-
const
|
|
2248
|
-
this.
|
|
2397
|
+
const i = this.paneMoveMode;
|
|
2398
|
+
this.synthesiseDragStateForKeyboardMove(), this.handleDrop(e ?? i.sourcePath, t);
|
|
2399
|
+
const o = this.dragState?.dropHandled === !0;
|
|
2400
|
+
this.dragState = null, this.clearPaneMoveState();
|
|
2401
|
+
const n = this.titles[i.paneName] ?? i.paneName;
|
|
2402
|
+
this.liveAnnouncer.announce(
|
|
2403
|
+
o ? `Pane ${n} docked to ${t}.` : `Move failed. Pane ${n} was not moved.`
|
|
2404
|
+
);
|
|
2249
2405
|
}
|
|
2250
2406
|
commitPaneMoveAsFloat() {
|
|
2251
2407
|
if (!this.paneMoveMode) return;
|
|
2252
2408
|
const t = this.paneMoveMode, e = this.resolveStackLocation(t.sourcePath);
|
|
2253
2409
|
if (!e) {
|
|
2254
|
-
this.
|
|
2410
|
+
this.clearPaneMoveState();
|
|
2255
2411
|
return;
|
|
2256
2412
|
}
|
|
2257
2413
|
this.removePaneFromLocation(e, t.paneName, !0);
|
|
@@ -2265,7 +2421,7 @@ class v extends _ {
|
|
|
2265
2421
|
root: { kind: "stack", panes: [t.paneName], activePane: t.paneName },
|
|
2266
2422
|
activePane: t.paneName
|
|
2267
2423
|
};
|
|
2268
|
-
this.floatingLayouts.push(i), this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), this.
|
|
2424
|
+
this.floatingLayouts.push(i), this.normalizeAllLayouts(), this.renderLayout(), this.dispatchLayoutChanged(), this.clearPaneMoveState();
|
|
2269
2425
|
const o = this.titles[t.paneName] ?? t.paneName;
|
|
2270
2426
|
this.liveAnnouncer.announce(`Pane ${o} torn off into a floating window.`);
|
|
2271
2427
|
}
|
|
@@ -2395,8 +2551,8 @@ class v extends _ {
|
|
|
2395
2551
|
return JSON.parse(JSON.stringify(t));
|
|
2396
2552
|
}
|
|
2397
2553
|
}
|
|
2398
|
-
const
|
|
2399
|
-
typeof customElements < "u" && !customElements.get(
|
|
2554
|
+
const x = "mint-dock-manager";
|
|
2555
|
+
typeof customElements < "u" && !customElements.get(x) && customElements.define(x, P);
|
|
2400
2556
|
export {
|
|
2401
|
-
|
|
2557
|
+
P as MintDockManagerElement
|
|
2402
2558
|
};
|