dockview-core 8.3.0 → 8.4.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.
Files changed (33) hide show
  1. package/dist/cjs/api/component.api.d.ts +26 -1
  2. package/dist/cjs/dismissableLayer.d.ts +19 -7
  3. package/dist/cjs/dnd/droptarget.d.ts +11 -0
  4. package/dist/cjs/dnd/ghost.d.ts +3 -0
  5. package/dist/cjs/dnd/pointer/pointerDragController.d.ts +1 -0
  6. package/dist/cjs/dnd/pointer/pointerDragSource.d.ts +1 -0
  7. package/dist/cjs/dnd/pointer/pointerDropTarget.d.ts +3 -0
  8. package/dist/cjs/dnd/pointer/pointerGhost.d.ts +6 -2
  9. package/dist/cjs/dnd/pointer/types.d.ts +5 -0
  10. package/dist/cjs/dockview/components/titlebar/tabGroups.d.ts +12 -3
  11. package/dist/cjs/dockview/components/titlebar/tabReorderController.d.ts +52 -21
  12. package/dist/cjs/dockview/components/titlebar/tabs.d.ts +4 -0
  13. package/dist/cjs/dockview/dndCapabilities.d.ts +3 -4
  14. package/dist/cjs/dockview/dockviewComponent.d.ts +31 -16
  15. package/dist/cjs/dockview/dockviewShell.d.ts +12 -0
  16. package/dist/cjs/dockview/options.d.ts +13 -0
  17. package/dist/cjs/dockview/popoutWindowService.d.ts +8 -2
  18. package/dist/cjs/dom.d.ts +61 -1
  19. package/dist/cjs/gridview/branchNode.d.ts +2 -1
  20. package/dist/cjs/gridview/gridview.d.ts +2 -1
  21. package/dist/cjs/index.d.ts +5 -1
  22. package/dist/cjs/popoutWindow.d.ts +57 -12
  23. package/dist/cjs/resizable.d.ts +12 -0
  24. package/dist/cjs/splitview/splitview.d.ts +3 -1
  25. package/dist/dockview-core.js +880 -390
  26. package/dist/dockview-core.min.js +29 -4
  27. package/dist/dockview-core.min.noStyle.js +2 -2
  28. package/dist/dockview-core.noStyle.js +879 -389
  29. package/dist/package/main.cjs.js +879 -389
  30. package/dist/package/main.cjs.min.js +2 -2
  31. package/dist/package/main.esm.min.mjs +2 -2
  32. package/dist/package/main.esm.mjs +878 -390
  33. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 8.3.0
3
+ * @version 8.4.0
4
4
  * @link https://github.com/dockview/dockview
5
5
  * @license MIT
6
6
  */
@@ -387,7 +387,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
387
387
  this._onDidBlur = new Emitter();
388
388
  this.onDidBlur = this._onDidBlur.event;
389
389
  this.addDisposables(this._onDidFocus, this._onDidBlur);
390
- let hasFocus = isAncestor(document.activeElement, element);
390
+ let hasFocus = isAncestor(getActiveElement(element), element);
391
391
  let loosingFocus = false;
392
392
  const onFocus = () => {
393
393
  loosingFocus = false;
@@ -409,7 +409,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
409
409
  }
410
410
  };
411
411
  this._refreshStateHandler = () => {
412
- if (isAncestor(document.activeElement, element) !== hasFocus) if (hasFocus) onBlur();
412
+ if (isAncestor(getActiveElement(element), element) !== hasFocus) if (hasFocus) onBlur();
413
413
  else onFocus();
414
414
  };
415
415
  this.addDisposables(addDisposableListener(element, "focus", onFocus, true));
@@ -426,6 +426,49 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
426
426
  function quasiDefaultPrevented(event) {
427
427
  return event[QUASI_PREVENT_DEFAULT_KEY];
428
428
  }
429
+ /** Whether the event originated within any of `elements`. Checks the
430
+ * composed path, so it also holds for elements inside a shadow root, which a
431
+ * window or document listener sees retargeted to the shadow host. */
432
+ function isEventWithin(event, elements) {
433
+ var _event$composedPath, _event$composedPath2;
434
+ const path = (_event$composedPath = (_event$composedPath2 = event.composedPath) === null || _event$composedPath2 === void 0 ? void 0 : _event$composedPath2.call(event)) !== null && _event$composedPath !== void 0 ? _event$composedPath : [];
435
+ if (path.length > 0) return elements.some((el) => path.includes(el));
436
+ const target = event.target;
437
+ return target instanceof Node && elements.some((el) => el.contains(target));
438
+ }
439
+ /** Every shadow root between `element` and its document, innermost first. An
440
+ * element in a component nested inside another component sits in more than
441
+ * one, and an event is cut at each boundary. */
442
+ function shadowRootsOf(node) {
443
+ const roots = [];
444
+ let root = node.getRootNode();
445
+ while (isShadowRoot(root)) {
446
+ roots.push(root);
447
+ root = root.host.getRootNode();
448
+ }
449
+ return roots;
450
+ }
451
+ /**
452
+ * `element` as a listener rooted in `scope`'s tree sees it. A node in a shadow
453
+ * root *below* that tree is retargeted to its host there, repeatedly for
454
+ * nested roots; a node already in the same tree is returned unchanged. Omit
455
+ * `scope` (or pass a node in the document) for the document-level view, which
456
+ * is what a window listener gets.
457
+ *
458
+ * The scope matters: a layer living inside a shadow root must be able to tell
459
+ * its own elements apart, and retargeting everything out to the document would
460
+ * collapse them all onto the one host.
461
+ */
462
+ function retargetInto(element, scope) {
463
+ const scopeRoot = scope === null || scope === void 0 ? void 0 : scope.getRootNode();
464
+ let current = element;
465
+ let root = current.getRootNode();
466
+ while (root !== scopeRoot && isShadowRoot(root)) {
467
+ current = root.host;
468
+ root = current.getRootNode();
469
+ }
470
+ return current;
471
+ }
429
472
  function addStyles(document, styleSheetList, options = {}) {
430
473
  const styleSheets = Array.from(styleSheetList);
431
474
  const { nonce } = options;
@@ -436,6 +479,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
436
479
  link.href = styleSheet.href;
437
480
  link.type = styleSheet.type;
438
481
  link.rel = "stylesheet";
482
+ if (resolvedNonce) link.setAttribute("nonce", resolvedNonce);
439
483
  document.head.appendChild(link);
440
484
  continue;
441
485
  }
@@ -475,6 +519,23 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
475
519
  else currentElement = currentElement.parentNode;
476
520
  return false;
477
521
  }
522
+ /** Duck-typed so it holds for a shadow root from another window's realm. */
523
+ function isShadowRoot(node) {
524
+ return !!node && node.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in node && !!node.host;
525
+ }
526
+ /**
527
+ * The document or shadow root to hit-test (`elementFromPoint` /
528
+ * `elementsFromPoint`) against for `node`. Hit-testing on the document stops
529
+ * at a shadow host, so when dockview is mounted in a shadow root it has to go
530
+ * through that root to reach its own elements. Falls back to the owning
531
+ * document (which may be a popout's) for a detached node.
532
+ */
533
+ function getHitTestRoot(node) {
534
+ var _node$ownerDocument;
535
+ const root = node.getRootNode();
536
+ if (root !== node && typeof root.elementsFromPoint === "function") return root;
537
+ return (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : document;
538
+ }
478
539
  function addTestId(element, id) {
479
540
  element.dataset.testid = id;
480
541
  }
@@ -509,6 +570,38 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
509
570
  iframes.splice(0, iframes.length);
510
571
  } };
511
572
  }
573
+ /**
574
+ * Suppress text selection for the duration of a pointer drag.
575
+ *
576
+ * A pointer drag is just a held button as far as the browser is concerned, so
577
+ * it selects text under the cursor as it travels. HTML5 drag-and-drop is
578
+ * exempt - the browser owns the gesture - which is why this is only needed on
579
+ * the pointer backend.
580
+ *
581
+ * `user-select: none` alone is not enough on WebKit: it starts the selection
582
+ * gesture from a mousedown on a `user-select: none` element unless that
583
+ * element is also natively draggable, then extends it into whatever the
584
+ * pointer crosses. Cancelling `selectstart` refuses that first extension,
585
+ * which ends the gesture for the rest of the drag.
586
+ *
587
+ * An existing selection is left alone: a mousedown on a `user-select: none`
588
+ * element does not clear one natively, and a pointer drag should not either.
589
+ */
590
+ function disableTextSelection(rootNode = document) {
591
+ const doc = rootNode instanceof Document ? rootNode : rootNode.ownerDocument;
592
+ const root = doc === null || doc === void 0 ? void 0 : doc.documentElement;
593
+ if (!doc || !root) return { release: () => void 0 };
594
+ const properties = ["user-select", "-webkit-user-select"];
595
+ const previous = properties.map((name) => [name, root.style.getPropertyValue(name)]);
596
+ for (const name of properties) root.style.setProperty(name, "none");
597
+ const onSelectStart = (event) => event.preventDefault();
598
+ doc.addEventListener("selectstart", onSelectStart);
599
+ return { release: () => {
600
+ doc.removeEventListener("selectstart", onSelectStart);
601
+ for (const [name, value] of previous) if (value) root.style.setProperty(name, value);
602
+ else root.style.removeProperty(name);
603
+ } };
604
+ }
512
605
  function getDockviewTheme(element) {
513
606
  function toClassList(element) {
514
607
  const list = [];
@@ -520,6 +613,11 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
520
613
  while (parent !== null) {
521
614
  theme = toClassList(parent).find((cls) => cls.startsWith("dockview-theme-"));
522
615
  if (typeof theme === "string") break;
616
+ if (parent.parentElement === null) {
617
+ const root = parent.getRootNode();
618
+ parent = isShadowRoot(root) ? root.host : null;
619
+ continue;
620
+ }
523
621
  parent = parent.parentElement;
524
622
  }
525
623
  return theme;
@@ -631,6 +729,285 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
631
729
  }
632
730
  return "";
633
731
  }
732
+ /** The focused element as seen from `node`'s own tree. Unlike
733
+ * `document.activeElement`, which is the shadow host when focus is inside a
734
+ * shadow root, this reaches into the root `node` lives in (and a popout's
735
+ * own document), while a web component nested inside that tree still
736
+ * resolves to its host there. */
737
+ function getActiveElement(node) {
738
+ var _root$activeElement;
739
+ const root = node.getRootNode();
740
+ const doc = root.nodeType === Node.DOCUMENT_NODE ? root : node.ownerDocument;
741
+ if (doc && typeof doc.hasFocus === "function" && !doc.hasFocus()) return null;
742
+ return (_root$activeElement = root.activeElement) !== null && _root$activeElement !== void 0 ? _root$activeElement : null;
743
+ }
744
+ /** Where to append a floating element (e.g. a drag ghost) for `node`: its
745
+ * shadow root when it lives in one, so styles scoped there still apply,
746
+ * otherwise the body of its own document (which may be a popout's). */
747
+ function getOverlayParent(node) {
748
+ var _node$ownerDocument2;
749
+ const root = node.getRootNode();
750
+ if (isShadowRoot(root)) return root;
751
+ return ((_node$ownerDocument2 = node.ownerDocument) !== null && _node$ownerDocument2 !== void 0 ? _node$ownerDocument2 : document).body;
752
+ }
753
+
754
+ //#endregion
755
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/asyncToGenerator.js
756
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
757
+ try {
758
+ var i = n[a](c), u = i.value;
759
+ } catch (n) {
760
+ e(n);
761
+ return;
762
+ }
763
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
764
+ }
765
+ function _asyncToGenerator(n) {
766
+ return function() {
767
+ var t = this, e = arguments;
768
+ return new Promise(function(r, o) {
769
+ var a = n.apply(t, e);
770
+ function _next(n) {
771
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
772
+ }
773
+ function _throw(n) {
774
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
775
+ }
776
+ _next(void 0);
777
+ });
778
+ };
779
+ }
780
+
781
+ //#endregion
782
+ //#region src/popoutWindow.ts
783
+ /**
784
+ * Throwing form of {@link getPopoutUrlError}, for callers with no way to
785
+ * recover from a refused URL.
786
+ */
787
+ function assertSameOriginPopoutUrl(url) {
788
+ const error = getPopoutUrlError(url);
789
+ if (error) throw error;
790
+ }
791
+ /**
792
+ * Schemes a popout must never open: each runs script in a context the browser
793
+ * still associates with the opener, or (for `file:`) has no origin to check.
794
+ */
795
+ const UNSAFE_POPOUT_PROTOCOLS = /* @__PURE__ */ new Set([
796
+ "javascript:",
797
+ "data:",
798
+ "blob:",
799
+ "vbscript:",
800
+ "file:"
801
+ ]);
802
+ /** How often an open popout window's `closed` flag is checked. */
803
+ const CLOSED_POLL_INTERVAL_MS = 250;
804
+ /**
805
+ * The reason `url` is unusable as a popout target, or `undefined` if it is
806
+ * allowed. Rejects anything that isn't same-origin with the page (scheme and
807
+ * host, so a packaged webview's own scheme such as `tauri://` qualifies), and
808
+ * the `javascript:`, `data:`, `blob:`, `vbscript:` and `file:` schemes that
809
+ * would otherwise execute in a context the browser still associates with the
810
+ * opener via `window.opener`.
811
+ *
812
+ * Callers that can recover from a refusal use this rather than catching, so it
813
+ * can be handled without a rejected promise. `page` is what the URL resolves
814
+ * against, and defaults to this page.
815
+ */
816
+ function getPopoutUrlError(url, page = globalThis.location) {
817
+ let resolved;
818
+ try {
819
+ resolved = new URL(url, page.href);
820
+ } catch (_unused) {
821
+ return /* @__PURE__ */ new Error(`dockview: invalid popout URL: ${url}`);
822
+ }
823
+ if (UNSAFE_POPOUT_PROTOCOLS.has(resolved.protocol)) return /* @__PURE__ */ new Error(`dockview: popout URL must not use the "${resolved.protocol}" protocol, which would run in the opener's context; got: ${url}`);
824
+ if (!(resolved.protocol === page.protocol && resolved.host === page.host)) return /* @__PURE__ */ new Error(`dockview: popout URL must be same-origin with the page (${page.protocol}//${page.host}); got: ${url}`);
825
+ }
826
+ var PopoutWindow = class extends CompositeDisposable {
827
+ get window() {
828
+ var _this$_window$value, _this$_window;
829
+ return (_this$_window$value = (_this$_window = this._window) === null || _this$_window === void 0 ? void 0 : _this$_window.value) !== null && _this$_window$value !== void 0 ? _this$_window$value : null;
830
+ }
831
+ /** Set when {@link open} resolved `null`, saying which way it failed. */
832
+ get failure() {
833
+ return this._failure;
834
+ }
835
+ constructor(target, className, options) {
836
+ super();
837
+ this.target = target;
838
+ this.className = className;
839
+ this.options = options;
840
+ this._onWillClose = new Emitter();
841
+ this.onWillClose = this._onWillClose.event;
842
+ this._onDidClose = new Emitter();
843
+ this.onDidClose = this._onDidClose.event;
844
+ this._window = null;
845
+ this.addDisposables(this._onWillClose, this._onDidClose, { dispose: () => {
846
+ this.close();
847
+ } });
848
+ }
849
+ dimensions() {
850
+ if (!this._window) return null;
851
+ const left = this._window.value.screenX;
852
+ return {
853
+ top: this._window.value.screenY,
854
+ left,
855
+ width: this._window.value.innerWidth,
856
+ height: this._window.value.innerHeight
857
+ };
858
+ }
859
+ close() {
860
+ var _this$options$onWillC, _this$options;
861
+ const current = this._window;
862
+ if (!current) return;
863
+ this._window = null;
864
+ this._onWillClose.fire();
865
+ (_this$options$onWillC = (_this$options = this.options).onWillClose) === null || _this$options$onWillC === void 0 || _this$options$onWillC.call(_this$options, {
866
+ id: this.target,
867
+ window: current.value
868
+ });
869
+ current.disposable.dispose();
870
+ this._onDidClose.fire();
871
+ }
872
+ open() {
873
+ var _this = this;
874
+ return _asyncToGenerator(function* () {
875
+ var _this$options$onDidOp, _this$options2;
876
+ if (_this._window) throw new Error("instance of popout window is already open");
877
+ const url = `${_this.options.url}`;
878
+ assertSameOriginPopoutUrl(url);
879
+ const features = Object.entries({
880
+ top: _this.options.top,
881
+ left: _this.options.left,
882
+ width: _this.options.width,
883
+ height: _this.options.height
884
+ }).map(([key, value]) => `${key}=${value}`).join(",");
885
+ /**
886
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open
887
+ */
888
+ const externalWindow = window.open(url, _this.target, features);
889
+ if (!externalWindow) {
890
+ _this._failure = { reason: "blocked" };
891
+ return null;
892
+ }
893
+ const disposable = new CompositeDisposable();
894
+ _this._window = {
895
+ value: externalWindow,
896
+ disposable
897
+ };
898
+ disposable.addDisposables(Disposable.from(() => {
899
+ externalWindow.close();
900
+ }), _this.watchForClose(externalWindow), addDisposableListener(globalThis.window, "beforeunload", () => {
901
+ /**
902
+ * before the main window closes we should close this popup too
903
+ * to be good citizens
904
+ *
905
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
906
+ */
907
+ _this.close();
908
+ }));
909
+ const container = _this.createPopoutWindowContainer();
910
+ if (_this.className) container.classList.add(_this.className);
911
+ (_this$options$onDidOp = (_this$options2 = _this.options).onDidOpen) === null || _this$options$onDidOp === void 0 || _this$options$onDidOp.call(_this$options2, {
912
+ id: _this.target,
913
+ window: externalWindow
914
+ });
915
+ return new Promise((resolve) => {
916
+ /**
917
+ * A host can answer `window.open` with a window in its own
918
+ * JavaScript context, which throws on first touch and cannot be
919
+ * filled with panel DOM. Settle as a blocked popup does, so the
920
+ * caller's fallback returns the group to the grid.
921
+ */
922
+ const abandon = (err) => {
923
+ _this._failure = {
924
+ reason: "unscriptable",
925
+ error: err instanceof Error ? err : new Error(String(err))
926
+ };
927
+ _this.close();
928
+ resolve(null);
929
+ };
930
+ try {
931
+ externalWindow.addEventListener("unload", () => {});
932
+ } catch (err) {
933
+ abandon(err);
934
+ return;
935
+ }
936
+ /**
937
+ * `load` is the only event that resolves this promise with a
938
+ * container, so a window that goes away first would leave the
939
+ * caller awaiting a promise that never settles - and
940
+ * `addPopoutGroup` holds its layout transaction open until it does.
941
+ * Settle with `null` on close, the same signal a blocked popup
942
+ * gives and one the caller already handles. `resolve` after the
943
+ * fact is a no-op, so a `load` that arrived first still wins.
944
+ */
945
+ disposable.addDisposables(_this.onWillClose(() => {
946
+ var _this$_failure;
947
+ (_this$_failure = _this._failure) !== null && _this$_failure !== void 0 || (_this._failure = { reason: "closed" });
948
+ resolve(null);
949
+ }));
950
+ externalWindow.addEventListener("load", () => {
951
+ /**
952
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
953
+ */
954
+ try {
955
+ var _globalThis$document$, _this$options$styleRo, _this$options3;
956
+ const externalDocument = externalWindow.document;
957
+ externalDocument.title = document.title;
958
+ externalDocument.body.appendChild(container);
959
+ addStyles(externalDocument, [...Array.from(globalThis.document.styleSheets), ...(_globalThis$document$ = globalThis.document.adoptedStyleSheets) !== null && _globalThis$document$ !== void 0 ? _globalThis$document$ : []], { nonce: _this.options.nonce });
960
+ const sheets = [];
961
+ for (let root = (_this$options$styleRo = (_this$options3 = _this.options).styleRoot) === null || _this$options$styleRo === void 0 ? void 0 : _this$options$styleRo.call(_this$options3); isShadowRoot(root); root = root.host.getRootNode()) {
962
+ var _root$styleSheets, _root$adoptedStyleShe;
963
+ sheets.push(...Array.from((_root$styleSheets = root.styleSheets) !== null && _root$styleSheets !== void 0 ? _root$styleSheets : []), ...(_root$adoptedStyleShe = root.adoptedStyleSheets) !== null && _root$adoptedStyleShe !== void 0 ? _root$adoptedStyleShe : []);
964
+ }
965
+ if (sheets.length > 0) addStyles(externalDocument, sheets, { nonce: _this.options.nonce });
966
+ /**
967
+ * beforeunload must be registered after load for reasons I could not determine
968
+ * otherwise the beforeunload event will not fire when the window is closed
969
+ */
970
+ addDisposableListener(externalWindow, "beforeunload", () => {
971
+ /**
972
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
973
+ */
974
+ _this.close();
975
+ });
976
+ resolve(container);
977
+ } catch (err) {
978
+ abandon(err);
979
+ }
980
+ });
981
+ });
982
+ })();
983
+ }
984
+ /**
985
+ * Backstop for the `beforeunload` signal, which a window torn down without
986
+ * running its unload handlers never sends: a native shell destroying the
987
+ * webview, or a browser discarding the page. `closed` is readable on any
988
+ * handle, cross-origin included. Whichever signal arrives first wins.
989
+ */
990
+ watchForClose(externalWindow) {
991
+ if (typeof externalWindow.closed !== "boolean") return Disposable.NONE;
992
+ const handle = setInterval(() => {
993
+ if (externalWindow.closed) this.close();
994
+ }, CLOSED_POLL_INTERVAL_MS);
995
+ return Disposable.from(() => {
996
+ clearInterval(handle);
997
+ });
998
+ }
999
+ createPopoutWindowContainer() {
1000
+ const el = document.createElement("div");
1001
+ el.classList.add("dv-popout-window");
1002
+ el.id = "dv-popout-window";
1003
+ el.style.position = "absolute";
1004
+ el.style.width = "100%";
1005
+ el.style.height = "100%";
1006
+ el.style.top = "0px";
1007
+ el.style.left = "0px";
1008
+ return el;
1009
+ }
1010
+ };
634
1011
 
635
1012
  //#endregion
636
1013
  //#region src/array.ts
@@ -850,6 +1227,15 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
850
1227
  get proportions() {
851
1228
  return this._proportions ? [...this._proportions] : void 0;
852
1229
  }
1230
+ get proportionalLayout() {
1231
+ return this._proportionalLayout;
1232
+ }
1233
+ set proportionalLayout(value) {
1234
+ if (this._proportionalLayout === value) return;
1235
+ this._proportionalLayout = value;
1236
+ if (value) this.saveProportions();
1237
+ else this._proportions = void 0;
1238
+ }
853
1239
  get orientation() {
854
1240
  return this._orientation;
855
1241
  }
@@ -974,7 +1360,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
974
1360
  this._orientation = (_options$orientation = options.orientation) !== null && _options$orientation !== void 0 ? _options$orientation : "VERTICAL";
975
1361
  this.element = this.createContainer();
976
1362
  this.margin = (_options$margin = options.margin) !== null && _options$margin !== void 0 ? _options$margin : 0;
977
- this.proportionalLayout = options.proportionalLayout === void 0 ? true : !!options.proportionalLayout;
1363
+ this._proportionalLayout = options.proportionalLayout === void 0 ? true : !!options.proportionalLayout;
978
1364
  this.viewContainer = this.createViewContainer();
979
1365
  this.sashContainer = this.createSashContainer();
980
1366
  this.element.appendChild(this.sashContainer);
@@ -1698,10 +2084,18 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
1698
2084
  if (child instanceof BranchNode) child.margin = value;
1699
2085
  });
1700
2086
  }
2087
+ get proportionalLayout() {
2088
+ return this.splitview.proportionalLayout;
2089
+ }
2090
+ set proportionalLayout(value) {
2091
+ this.splitview.proportionalLayout = value;
2092
+ this.children.forEach((child) => {
2093
+ if (child instanceof BranchNode) child.proportionalLayout = value;
2094
+ });
2095
+ }
1701
2096
  constructor(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, margin, childDescriptors) {
1702
2097
  super();
1703
2098
  this.orientation = orientation;
1704
- this.proportionalLayout = proportionalLayout;
1705
2099
  this.styles = styles;
1706
2100
  this._childrenDisposable = Disposable.NONE;
1707
2101
  this.children = [];
@@ -2243,8 +2637,13 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
2243
2637
  }
2244
2638
  return findLeaf(this.root, reverse);
2245
2639
  }
2640
+ get proportionalLayout() {
2641
+ return this.root.proportionalLayout;
2642
+ }
2643
+ set proportionalLayout(value) {
2644
+ this.root.proportionalLayout = value;
2645
+ }
2246
2646
  constructor(proportionalLayout, styles, orientation, locked, margin) {
2247
- this.proportionalLayout = proportionalLayout;
2248
2647
  this.styles = styles;
2249
2648
  this._locked = false;
2250
2649
  this._margin = 0;
@@ -2438,6 +2837,25 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
2438
2837
  this.layout(width, height);
2439
2838
  }));
2440
2839
  }
2840
+ /**
2841
+ * Lay out from the element's current size.
2842
+ *
2843
+ * The ResizeObserver above only reports asynchronously, so between
2844
+ * construction and its first callback the component believes it has no
2845
+ * size - and anything built in that window (panels added right after
2846
+ * `createDockview`, say) resolves its sizes against zero and collapses to
2847
+ * minimums. Concrete components call this once they are fully constructed
2848
+ * so that work sees the real size. The same guards as the observer apply:
2849
+ * a detached or hidden element has no size worth propagating.
2850
+ */
2851
+ layoutFromElement() {
2852
+ if (this.disableResizing || !this._element.offsetParent) return;
2853
+ if (!isInDocument(this._element)) return;
2854
+ const width = Math.round(this._element.clientWidth);
2855
+ const height = Math.round(this._element.clientHeight);
2856
+ if (width === 0 || height === 0) return;
2857
+ this.layout(width, height);
2858
+ }
2441
2859
  };
2442
2860
 
2443
2861
  //#endregion
@@ -2538,7 +2956,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
2538
2956
  return this.gridview.isViewVisible(getGridLocation(panel.element));
2539
2957
  }
2540
2958
  updateOptions(options) {
2541
- if (typeof options.proportionalLayout === "boolean") {}
2959
+ if ("proportionalLayout" in options) {
2960
+ var _options$proportional;
2961
+ this.gridview.proportionalLayout = (_options$proportional = options.proportionalLayout) !== null && _options$proportional !== void 0 ? _options$proportional : true;
2962
+ }
2542
2963
  if (options.orientation) this.gridview.orientation = options.orientation;
2543
2964
  if ("styles" in options) {}
2544
2965
  if ("disableAutoResizing" in options) {
@@ -3347,6 +3768,15 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
3347
3768
  get onUnhandledDragOver() {
3348
3769
  return this.component.onUnhandledDragOver;
3349
3770
  }
3771
+ /**
3772
+ * The drag-and-drop backends currently live: `dndStrategy` resolved against
3773
+ * this device, which `'auto'` reads from the primary input device. Only an
3774
+ * HTML5 drag can leave the window it started in, so check `html5` before
3775
+ * relying on a drag between a popout window and the main window.
3776
+ */
3777
+ get dndCapabilities() {
3778
+ return this.component.dndCapabilities;
3779
+ }
3350
3780
  get onDidPopoutGroupSizeChange() {
3351
3781
  return this.component.onDidPopoutGroupSizeChange;
3352
3782
  }
@@ -3369,9 +3799,27 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
3369
3799
  get onDidRemovePopoutGroup() {
3370
3800
  return this.component.onDidRemovePopoutGroup;
3371
3801
  }
3802
+ /**
3803
+ * Fires when a popout window could not be used, carrying which way it
3804
+ * failed: the URL was refused, the browser blocked the window, the host
3805
+ * returned a window whose document the opener cannot reach, or it closed
3806
+ * before loading. The group stays in (or returns to) the main grid.
3807
+ */
3372
3808
  get onDidOpenPopoutWindowFail() {
3373
3809
  return this.component.onDidOpenPopoutWindowFail;
3374
3810
  }
3811
+ /**
3812
+ * Fires as dockview lets go of a popout window, while that window is still
3813
+ * open, carrying its live `Window` handle. Covers every popout the component
3814
+ * opened and every reason for closing one, disposal included;
3815
+ * {@link onDidAddPopoutGroup} is the opening half.
3816
+ *
3817
+ * For hosts that own their windows: in a desktop webview the page's own
3818
+ * `close()` can be a no-op, so the shell has to be told.
3819
+ */
3820
+ get onWillClosePopoutWindow() {
3821
+ return this.component.onWillClosePopoutWindow;
3822
+ }
3375
3823
  /** Enumerate the popout groups currently open in their own windows. */
3376
3824
  getPopouts() {
3377
3825
  return this.component.getPopouts();
@@ -4338,7 +4786,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4338
4786
  var _options$ownerDocumen, _options$x, _options$y;
4339
4787
  addClasses(ghostElement, "dv-dragged");
4340
4788
  ghostElement.style.top = "-9999px";
4341
- ((_options$ownerDocumen = options === null || options === void 0 ? void 0 : options.ownerDocument) !== null && _options$ownerDocumen !== void 0 ? _options$ownerDocumen : document).body.appendChild(ghostElement);
4789
+ ghostElement.style.position = "absolute";
4790
+ ((options === null || options === void 0 ? void 0 : options.owner) ? getOverlayParent(options.owner) : ((_options$ownerDocumen = options === null || options === void 0 ? void 0 : options.ownerDocument) !== null && _options$ownerDocumen !== void 0 ? _options$ownerDocumen : document).body).appendChild(ghostElement);
4342
4791
  dataTransfer.setDragImage(ghostElement, (_options$x = options === null || options === void 0 ? void 0 : options.x) !== null && _options$x !== void 0 ? _options$x : 0, (_options$y = options === null || options === void 0 ? void 0 : options.y) !== null && _options$y !== void 0 ? _options$y : 0);
4343
4792
  setTimeout(() => {
4344
4793
  removeClasses(ghostElement, "dv-dragged");
@@ -4390,7 +4839,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4390
4839
  } };
4391
4840
  }
4392
4841
  beginDrag(args) {
4393
- var _source$ownerDocument, _source$ownerDocument2, _source$ownerDocument3;
4842
+ var _source$ownerDocument, _source$ownerDocument2, _source$ownerDocument3, _source$ownerDocument4;
4394
4843
  if (this._active) this.cancel();
4395
4844
  const { pointerEvent, source } = args;
4396
4845
  const dataDisposable = args.getData();
@@ -4406,13 +4855,14 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4406
4855
  this._dataDisposable = dataDisposable;
4407
4856
  this._ghost = args.ghost;
4408
4857
  this._iframeShield = disableIframePointEvents((_source$ownerDocument = source.ownerDocument) !== null && _source$ownerDocument !== void 0 ? _source$ownerDocument : document);
4858
+ this._selectionShield = disableTextSelection((_source$ownerDocument2 = source.ownerDocument) !== null && _source$ownerDocument2 !== void 0 ? _source$ownerDocument2 : document);
4409
4859
  const startEvent = {
4410
4860
  clientX: pointerEvent.clientX,
4411
4861
  clientY: pointerEvent.clientY,
4412
4862
  pointerEvent
4413
4863
  };
4414
4864
  this._onDragStart.fire(startEvent);
4415
- const targetWindow = (_source$ownerDocument2 = (_source$ownerDocument3 = source.ownerDocument) === null || _source$ownerDocument3 === void 0 ? void 0 : _source$ownerDocument3.defaultView) !== null && _source$ownerDocument2 !== void 0 ? _source$ownerDocument2 : globalThis.window;
4865
+ const targetWindow = (_source$ownerDocument3 = (_source$ownerDocument4 = source.ownerDocument) === null || _source$ownerDocument4 === void 0 ? void 0 : _source$ownerDocument4.defaultView) !== null && _source$ownerDocument3 !== void 0 ? _source$ownerDocument3 : globalThis.window;
4416
4866
  this._moveListener = addDisposableListener(targetWindow, "pointermove", (e) => {
4417
4867
  var _this$_active;
4418
4868
  if (e.pointerId !== ((_this$_active = this._active) === null || _this$_active === void 0 ? void 0 : _this$_active.pointerId)) return;
@@ -4449,13 +4899,13 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4449
4899
  }
4450
4900
  }
4451
4901
  _findTargetUnder(x, y) {
4452
- var _this$_active$source$, _this$_active4;
4453
- const elements = ((_this$_active$source$ = (_this$_active4 = this._active) === null || _this$_active4 === void 0 ? void 0 : _this$_active4.source.ownerDocument) !== null && _this$_active$source$ !== void 0 ? _this$_active$source$ : document).elementsFromPoint(x, y);
4902
+ const elements = (this._active ? getHitTestRoot(this._active.source) : document).elementsFromPoint(x, y);
4454
4903
  for (const el of elements) {
4455
4904
  let current = el;
4456
4905
  while (current) {
4906
+ var _target$isHitTestTran;
4457
4907
  const target = this._targetByElement.get(current);
4458
- if (target) return target;
4908
+ if (target && !((_target$isHitTestTran = target.isHitTestTransparent) === null || _target$isHitTestTran === void 0 ? void 0 : _target$isHitTestTran.call(target))) return target;
4459
4909
  current = current.parentElement;
4460
4910
  }
4461
4911
  }
@@ -4499,7 +4949,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4499
4949
  this._onDragEnd.fire(dragEvent);
4500
4950
  }
4501
4951
  _teardown() {
4502
- var _this$_ghost2, _this$_iframeShield, _this$_moveListener, _this$_upListener, _this$_cancelListener;
4952
+ var _this$_ghost2, _this$_iframeShield, _this$_selectionShiel, _this$_moveListener, _this$_upListener, _this$_cancelListener;
4503
4953
  this._currentTarget = void 0;
4504
4954
  this._active = void 0;
4505
4955
  this._lastPointerEvent = void 0;
@@ -4509,6 +4959,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4509
4959
  this._ghost = void 0;
4510
4960
  (_this$_iframeShield = this._iframeShield) === null || _this$_iframeShield === void 0 || _this$_iframeShield.release();
4511
4961
  this._iframeShield = void 0;
4962
+ (_this$_selectionShiel = this._selectionShield) === null || _this$_selectionShiel === void 0 || _this$_selectionShiel.release();
4963
+ this._selectionShield = void 0;
4512
4964
  (_this$_moveListener = this._moveListener) === null || _this$_moveListener === void 0 || _this$_moveListener.dispose();
4513
4965
  (_this$_upListener = this._upListener) === null || _this$_upListener === void 0 || _this$_upListener.dispose();
4514
4966
  (_this$_cancelListener = this._cancelListener) === null || _this$_cancelListener === void 0 || _this$_cancelListener.dispose();
@@ -4551,10 +5003,14 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4551
5003
  element: this.element,
4552
5004
  handleDragOver: (e) => this._onDragOver(e),
4553
5005
  handleDragLeave: () => this._onDragLeave(),
4554
- handleDrop: (e) => this._onDropEvent(e)
5006
+ handleDrop: (e) => this._onDropEvent(e),
5007
+ isHitTestTransparent: options.isHitTestTransparent
4555
5008
  };
4556
5009
  this.addDisposables(this._onDrop, this._onWillShowOverlay, PointerDragController.getInstance().registerTarget(handle));
4557
5010
  }
5011
+ clearOverlay() {
5012
+ this._clearOwnOverlay();
5013
+ }
4558
5014
  setTargetZones(zones) {
4559
5015
  this._acceptedTargetZonesSet = new Set(zones);
4560
5016
  }
@@ -4773,9 +5229,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4773
5229
  return true;
4774
5230
  }
4775
5231
  _onPointerDown(event) {
4776
- var _ref, _this$options$thresho, _ref2, _this$element$ownerDo, _this$element$ownerDo2;
5232
+ var _this$element$ownerDo, _ref, _this$options$thresho, _ref2, _this$element$ownerDo2, _this$element$ownerDo3;
4777
5233
  if (!this._shouldHandle(event)) return;
4778
5234
  this._cancelPending();
5235
+ this._selectionShield = disableTextSelection((_this$element$ownerDo = this.element.ownerDocument) !== null && _this$element$ownerDo !== void 0 ? _this$element$ownerDo : document);
4779
5236
  this._pendingPointerId = event.pointerId;
4780
5237
  this._startX = event.clientX;
4781
5238
  this._startY = event.clientY;
@@ -4791,7 +5248,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4791
5248
  const threshold = (_this$options$thresho = this.options.threshold) !== null && _this$options$thresho !== void 0 ? _this$options$thresho : DEFAULT_THRESHOLD;
4792
5249
  const pressToleranceOpt = this.options.pressTolerance;
4793
5250
  const pressTolerance = (_ref2 = typeof pressToleranceOpt === "function" ? pressToleranceOpt() : pressToleranceOpt) !== null && _ref2 !== void 0 ? _ref2 : DEFAULT_PRESS_TOLERANCE;
4794
- const targetWindow = (_this$element$ownerDo = (_this$element$ownerDo2 = this.element.ownerDocument) === null || _this$element$ownerDo2 === void 0 ? void 0 : _this$element$ownerDo2.defaultView) !== null && _this$element$ownerDo !== void 0 ? _this$element$ownerDo : globalThis.window;
5251
+ const targetWindow = (_this$element$ownerDo2 = (_this$element$ownerDo3 = this.element.ownerDocument) === null || _this$element$ownerDo3 === void 0 ? void 0 : _this$element$ownerDo3.defaultView) !== null && _this$element$ownerDo2 !== void 0 ? _this$element$ownerDo2 : globalThis.window;
4795
5252
  this._pendingMoveListener = addDisposableListener(targetWindow, "pointermove", (moveEvent) => {
4796
5253
  if (moveEvent.pointerId !== this._pendingPointerId) return;
4797
5254
  const dx = moveEvent.clientX - this._startX;
@@ -4817,7 +5274,9 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4817
5274
  this._cancelPending();
4818
5275
  }
4819
5276
  _cancelPending() {
4820
- var _this$_pendingMoveLis, _this$_pendingUpListe, _this$_pendingCancelL;
5277
+ var _this$_selectionShiel, _this$_pendingMoveLis, _this$_pendingUpListe, _this$_pendingCancelL;
5278
+ (_this$_selectionShiel = this._selectionShield) === null || _this$_selectionShiel === void 0 || _this$_selectionShiel.release();
5279
+ this._selectionShield = void 0;
4821
5280
  this._pendingPointerId = void 0;
4822
5281
  if (this._armTimer !== void 0) {
4823
5282
  clearTimeout(this._armTimer);
@@ -4862,29 +5321,51 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4862
5321
  */
4863
5322
  var PointerGhost = class {
4864
5323
  constructor(opts) {
4865
- var _opts$offsetX, _opts$offsetY, _opts$opacity, _opts$owner$ownerDocu, _opts$owner;
5324
+ var _opts$offsetX, _opts$offsetY, _popover, _opts$opacity;
4866
5325
  this._disposed = false;
4867
5326
  this.element = opts.element;
4868
5327
  this.offsetX = (_opts$offsetX = opts.offsetX) !== null && _opts$offsetX !== void 0 ? _opts$offsetX : 0;
4869
5328
  this.offsetY = (_opts$offsetY = opts.offsetY) !== null && _opts$offsetY !== void 0 ? _opts$offsetY : 0;
4870
- this.element.style.position = "fixed";
4871
- this.element.style.left = "0px";
4872
- this.element.style.top = "0px";
4873
- this.element.style.pointerEvents = "none";
4874
- this.element.style.zIndex = "99999";
4875
- this.element.style.opacity = String((_opts$opacity = opts.opacity) !== null && _opts$opacity !== void 0 ? _opts$opacity : .8);
4876
- this.element.style.willChange = "transform";
4877
- this.element.style.transform = `translate3d(${opts.initialX - this.offsetX}px, ${opts.initialY - this.offsetY}px, 0)`;
4878
- ((_opts$owner$ownerDocu = (_opts$owner = opts.owner) === null || _opts$owner === void 0 ? void 0 : _opts$owner.ownerDocument) !== null && _opts$owner$ownerDocu !== void 0 ? _opts$owner$ownerDocu : document).body.appendChild(this.element);
5329
+ const parent = opts.owner ? getOverlayParent(opts.owner) : document.body;
5330
+ let popover;
5331
+ if (isShadowRoot(parent) && typeof this.element.showPopover === "function") {
5332
+ popover = this.element.ownerDocument.createElement("div");
5333
+ popover.popover = "manual";
5334
+ Object.assign(popover.style, {
5335
+ inset: "auto",
5336
+ margin: "0",
5337
+ padding: "0",
5338
+ border: "0",
5339
+ background: "transparent",
5340
+ color: "inherit",
5341
+ overflow: "visible"
5342
+ });
5343
+ popover.appendChild(this.element);
5344
+ this.element.style.pointerEvents = "none";
5345
+ this.element.style.transform = "none";
5346
+ }
5347
+ this.container = (_popover = popover) !== null && _popover !== void 0 ? _popover : this.element;
5348
+ const style = this.container.style;
5349
+ style.position = "fixed";
5350
+ style.left = "0px";
5351
+ style.top = "0px";
5352
+ style.pointerEvents = "none";
5353
+ style.zIndex = "99999";
5354
+ style.opacity = String((_opts$opacity = opts.opacity) !== null && _opts$opacity !== void 0 ? _opts$opacity : .8);
5355
+ style.willChange = "transform";
5356
+ style.transform = `translate3d(${opts.initialX - this.offsetX}px, ${opts.initialY - this.offsetY}px, 0)`;
5357
+ parent.appendChild(this.container);
5358
+ popover === null || popover === void 0 || popover.showPopover();
4879
5359
  }
4880
5360
  update(clientX, clientY) {
4881
5361
  if (this._disposed) return;
4882
- this.element.style.transform = `translate3d(${clientX - this.offsetX}px, ${clientY - this.offsetY}px, 0)`;
5362
+ this.container.style.transform = `translate3d(${clientX - this.offsetX}px, ${clientY - this.offsetY}px, 0)`;
4883
5363
  }
4884
5364
  dispose() {
4885
5365
  if (this._disposed) return;
4886
5366
  this._disposed = true;
4887
5367
  this.element.remove();
5368
+ if (this.container !== this.element) this.container.remove();
4888
5369
  }
4889
5370
  };
4890
5371
 
@@ -4921,7 +5402,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4921
5402
  addGhostImage(event.dataTransfer, ghost.element, {
4922
5403
  x: (_ghost$offsetX = ghost.offsetX) !== null && _ghost$offsetX !== void 0 ? _ghost$offsetX : 0,
4923
5404
  y: (_ghost$offsetY = ghost.offsetY) !== null && _ghost$offsetY !== void 0 ? _ghost$offsetY : 0,
4924
- ownerDocument: (_this$el$ownerDocumen2 = this.el.ownerDocument) !== null && _this$el$ownerDocumen2 !== void 0 ? _this$el$ownerDocumen2 : void 0
5405
+ ownerDocument: (_this$el$ownerDocumen2 = this.el.ownerDocument) !== null && _this$el$ownerDocumen2 !== void 0 ? _this$el$ownerDocumen2 : void 0,
5406
+ owner: this.el
4925
5407
  });
4926
5408
  if (ghost.dispose) {
4927
5409
  const disposeGhost = ghost.dispose;
@@ -5757,8 +6239,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
5757
6239
  let guard;
5758
6240
  const timeout = setTimeout(() => guard === null || guard === void 0 ? void 0 : guard.dispose(), 500);
5759
6241
  guard = addDisposableListener(targetWindow, "click", (event) => {
5760
- const target = event.target;
5761
- if (target && this.element.contains(target)) {
6242
+ if (isEventWithin(event, [this.element])) {
5762
6243
  event.preventDefault();
5763
6244
  event.stopPropagation();
5764
6245
  }
@@ -5874,6 +6355,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
5874
6355
  if (this.accessor.id === (data === null || data === void 0 ? void 0 : data.viewId)) {
5875
6356
  var _this$accessor$option;
5876
6357
  if (((_this$accessor$option = this.accessor.options.theme) === null || _this$accessor$option === void 0 ? void 0 : _this$accessor$option.tabAnimation) === "smooth") return false;
6358
+ if (data.tabGroupId && data.groupId === this.group.id && this.group.model.getTabGroupForPanel(this.panel.id)) return false;
5877
6359
  return true;
5878
6360
  }
5879
6361
  return this.group.model.canDisplayOverlay(event, position, "tab");
@@ -6486,6 +6968,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
6486
6968
  const PROPERTY_KEYS_DOCKVIEW = (() => {
6487
6969
  return Object.keys({
6488
6970
  disableAutoResizing: void 0,
6971
+ proportionalLayout: void 0,
6489
6972
  hideBorders: void 0,
6490
6973
  singleTabMode: void 0,
6491
6974
  disableFloatingGroups: void 0,
@@ -7321,12 +7804,34 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7321
7804
  }
7322
7805
  updateDirection() {
7323
7806
  const isVertical = this._ctx.getDirection() === "vertical";
7324
- for (const [, entry] of this._chipRenderers) entry.dropTarget.setTargetZones(isVertical ? ["top"] : ["left"]);
7807
+ for (const [, entry] of this._chipRenderers) {
7808
+ const zones = isVertical ? ["top"] : ["left"];
7809
+ entry.dropTarget.setTargetZones(zones);
7810
+ entry.pointerDropTarget.setTargetZones(zones);
7811
+ }
7325
7812
  }
7326
- snapshotChipWidths() {
7327
- const widths = /* @__PURE__ */ new Map();
7328
- for (const [groupId, entry] of this._chipRenderers) widths.set(groupId, entry.chip.element.getBoundingClientRect().width);
7329
- return widths;
7813
+ /**
7814
+ * Drop any overlay the chips are showing. A group move is committed by a
7815
+ * capturing listener on the tabs list that stops the event, so the chip
7816
+ * target under the cursor never sees the drop that would clear its own.
7817
+ */
7818
+ clearChipDropOverlays() {
7819
+ for (const [, entry] of this._chipRenderers) {
7820
+ var _entry$dropTarget, _entry$pointerDropTar;
7821
+ (_entry$dropTarget = entry.dropTarget) === null || _entry$dropTarget === void 0 || _entry$dropTarget.clearOverlay();
7822
+ (_entry$pointerDropTar = entry.pointerDropTarget) === null || _entry$pointerDropTar === void 0 || _entry$pointerDropTar.clearOverlay();
7823
+ }
7824
+ }
7825
+ /** Each chip's extent along the strip's main axis: width for a horizontal
7826
+ * header, height for a vertical one. */
7827
+ snapshotChipSizes() {
7828
+ const isVertical = this._ctx.getDirection() === "vertical";
7829
+ const sizes = /* @__PURE__ */ new Map();
7830
+ for (const [groupId, entry] of this._chipRenderers) {
7831
+ const rect = entry.chip.element.getBoundingClientRect();
7832
+ sizes.set(groupId, isVertical ? rect.height : rect.width);
7833
+ }
7834
+ return sizes;
7330
7835
  }
7331
7836
  positionUnderlines() {
7332
7837
  var _this$_indicator2;
@@ -7570,9 +8075,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7570
8075
  };
7571
8076
  if (chip instanceof TabGroupChip) disposables.push(chip.onContextMenu(onContextMenu));
7572
8077
  else disposables.push(new LongPressDetector(chip.element, { onLongPress: onContextMenu }), addDisposableListener(chip.element, "contextmenu", onContextMenu));
7573
- const isVertical = this._ctx.getDirection() === "vertical";
7574
- const dropTarget = new Droptarget(chip.element, {
7575
- acceptedTargetZones: isVertical ? ["top"] : ["left"],
8078
+ const dropTargetOptions = {
8079
+ acceptedTargetZones: this._ctx.getDirection() === "vertical" ? ["top"] : ["left"],
7576
8080
  overlayModel: { activationSize: {
7577
8081
  value: 100,
7578
8082
  type: "percentage"
@@ -7583,15 +8087,18 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7583
8087
  const data = getPanelData();
7584
8088
  if (this._ctx.accessor.id === (data === null || data === void 0 ? void 0 : data.viewId)) {
7585
8089
  var _this$_ctx$accessor$o3;
7586
- if (((_this$_ctx$accessor$o3 = this._ctx.accessor.options.theme) === null || _this$_ctx$accessor$o3 === void 0 ? void 0 : _this$_ctx$accessor$o3.tabAnimation) === "smooth") return false;
8090
+ if (((_this$_ctx$accessor$o3 = this._ctx.accessor.options.theme) === null || _this$_ctx$accessor$o3 === void 0 ? void 0 : _this$_ctx$accessor$o3.tabAnimation) === "smooth" && !data.tabGroupId) return false;
7587
8091
  return true;
7588
8092
  }
7589
8093
  return this._ctx.group.model.canDisplayOverlay(event, position, "tab");
7590
8094
  }
7591
- });
7592
- disposables.push(dropTarget, dropTarget.onDrop((event) => {
8095
+ };
8096
+ const dropTarget = html5Backend.createDropTarget(chip.element, dropTargetOptions);
8097
+ const pointerDropTarget = pointerBackend.createDropTarget(chip.element, dropTargetOptions);
8098
+ const onDrop = (event) => {
7593
8099
  this._callbacks.onChipDrop(tabGroup, event);
7594
- }));
8100
+ };
8101
+ disposables.push(dropTarget, dropTarget.onDrop(onDrop), pointerDropTarget, pointerDropTarget.onDrop(onDrop));
7595
8102
  const disposable = new CompositeDisposable(...disposables);
7596
8103
  this._chipRenderers.set(tabGroup.id, {
7597
8104
  chip,
@@ -7599,7 +8106,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7599
8106
  pointerDragSource: dragSources.pointerDragSource,
7600
8107
  dragSourcesDisposable: dragSources.disposable,
7601
8108
  disposable,
7602
- dropTarget
8109
+ dropTarget,
8110
+ pointerDropTarget
7603
8111
  });
7604
8112
  if (tabGroup.collapsed) this._skipNextCollapseAnimation = true;
7605
8113
  }
@@ -7715,6 +8223,22 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7715
8223
  //#endregion
7716
8224
  //#region src/dockview/components/titlebar/tabReorderController.ts
7717
8225
  /**
8226
+ * Main-axis extent of a rect. Tabs flow along x in a horizontal header
8227
+ * (top/bottom) and along y in a vertical one (the left/right edge groups),
8228
+ * so the reorder math reads every size through this.
8229
+ */
8230
+ function mainAxisSize(rect, direction) {
8231
+ return direction === "vertical" ? rect.height : rect.width;
8232
+ }
8233
+ /** Leading edge of a rect along the main axis. */
8234
+ function mainAxisStart(rect, direction) {
8235
+ return direction === "vertical" ? rect.top : rect.left;
8236
+ }
8237
+ /** A cursor position projected onto the main axis. */
8238
+ function mainAxisCursor(event, direction) {
8239
+ return direction === "vertical" ? event.clientY : event.clientX;
8240
+ }
8241
+ /**
7718
8242
  * Tab drag-reorder + FLIP animation subsystem extracted from `Tabs`. The DOM
7719
8243
  * event wiring remains in `Tabs` and delegates the reorder/animation logic to
7720
8244
  * this controller. All access back into `Tabs` goes through
@@ -7809,14 +8333,30 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7809
8333
  for (const tab of this._tabs) positions.set(tab.value.panel.id, tab.value.element.getBoundingClientRect());
7810
8334
  return positions;
7811
8335
  }
7812
- getAverageTabWidth() {
8336
+ /** Main-axis extent of a rect for this header's orientation. */
8337
+ _mainAxisSize(rect) {
8338
+ return mainAxisSize(rect, this._direction);
8339
+ }
8340
+ /** Main-axis leading edge of a rect for this header's orientation. */
8341
+ _mainAxisStart(rect) {
8342
+ return mainAxisStart(rect, this._direction);
8343
+ }
8344
+ /** The cursor coordinate along the main axis. */
8345
+ _mainAxisCoord(clientX, clientY) {
8346
+ return mainAxisCursor({
8347
+ clientX,
8348
+ clientY
8349
+ }, this._direction);
8350
+ }
8351
+ /** The margin that opens the insertion gap. It must run along the main
8352
+ * axis, so a vertical header pushes tabs down rather than sideways. */
8353
+ get _gapMarginProperty() {
8354
+ return this._direction === "vertical" ? "margin-top" : "margin-left";
8355
+ }
8356
+ getAverageTabSize() {
7813
8357
  if (this._tabs.length === 0) return 0;
7814
- const isVertical = this._direction === "vertical";
7815
8358
  let total = 0;
7816
- for (const tab of this._tabs) {
7817
- const rect = tab.value.element.getBoundingClientRect();
7818
- total += isVertical ? rect.height : rect.width;
7819
- }
8359
+ for (const tab of this._tabs) total += this._mainAxisSize(tab.value.element.getBoundingClientRect());
7820
8360
  return total / this._tabs.length;
7821
8361
  }
7822
8362
  /**
@@ -7826,8 +8366,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7826
8366
  * `processDragOver` / `processDragLeave` helpers.
7827
8367
  */
7828
8368
  handlePointerDragMove(clientX, clientY) {
7829
- var _this$_tabsList$owner;
7830
- const elAtPoint = ((_this$_tabsList$owner = this._tabsList.ownerDocument) !== null && _this$_tabsList$owner !== void 0 ? _this$_tabsList$owner : document).elementFromPoint(clientX, clientY);
8369
+ const elAtPoint = getHitTestRoot(this._tabsList).elementFromPoint(clientX, clientY);
7831
8370
  if (!(!!elAtPoint && (this._tabsList.contains(elAtPoint) || !!this._extendedDropZone && this._extendedDropZone.contains(elAtPoint)))) {
7832
8371
  if (this._pointerInsideTabsList) {
7833
8372
  this._pointerInsideTabsList = false;
@@ -7844,13 +8383,19 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7844
8383
  * dragover bridge may have installed.
7845
8384
  */
7846
8385
  handlePointerDragEnd(e) {
7847
- if (e && this._animState && this._animState.sourceIndex !== -1 && !this._animState.sourceTabGroupId && this._animState.currentInsertionIndex !== null && this.isPointInsideTabsList(e.clientX, e.clientY)) this.commitPointerReorder(e.pointerEvent);
8386
+ if (e && this._animState && this._animState.sourceIndex !== -1 && this._animState.currentInsertionIndex !== null && this.isPointInsideTabsList(e.clientX, e.clientY)) {
8387
+ const sourceTabGroupId = this._animState.sourceTabGroupId;
8388
+ if (sourceTabGroupId) {
8389
+ const insertionIndex = this._animState.currentInsertionIndex;
8390
+ this._animState = null;
8391
+ this.commitGroupMove(sourceTabGroupId, insertionIndex);
8392
+ } else this.commitPointerReorder(e.pointerEvent);
8393
+ }
7848
8394
  this._pointerInsideTabsList = false;
7849
8395
  this.resetDragAnimation();
7850
8396
  }
7851
8397
  isPointInsideTabsList(clientX, clientY) {
7852
- var _this$_tabsList$owner2;
7853
- const el = ((_this$_tabsList$owner2 = this._tabsList.ownerDocument) !== null && _this$_tabsList$owner2 !== void 0 ? _this$_tabsList$owner2 : document).elementFromPoint(clientX, clientY);
8398
+ const el = getHitTestRoot(this._tabsList).elementFromPoint(clientX, clientY);
7854
8399
  return !!el && this._tabsList.contains(el);
7855
8400
  }
7856
8401
  /** Commit a smooth-mode intra-group reorder from the current insertion
@@ -7914,46 +8459,46 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7914
8459
  const data = getPanelData();
7915
8460
  if (((_this$accessor$option = this.accessor.options.theme) === null || _this$accessor$option === void 0 ? void 0 : _this$accessor$option.tabAnimation) === "default" && !(data === null || data === void 0 ? void 0 : data.tabGroupId)) return false;
7916
8461
  if (!data || !(data.panelId || data.tabGroupId) || data.groupId === this.group.id) return false;
7917
- const avgWidth = this.getAverageTabWidth();
7918
- this._animState = data.tabGroupId ? this._makeGroupDragAnimState(data, avgWidth) : this._makeTabDragAnimState(data, avgWidth);
8462
+ const avgSize = this.getAverageTabSize();
8463
+ this._animState = data.tabGroupId ? this._makeGroupDragAnimState(data, avgSize) : this._makeTabDragAnimState(data, avgSize);
7919
8464
  return true;
7920
8465
  }
7921
8466
  /** Anim state for an external group-chip drag (gap sized to the group). */
7922
- _makeGroupDragAnimState(data, avgWidth) {
8467
+ _makeGroupDragAnimState(data, avgSize) {
7923
8468
  var _sourceTg$panelIds$le;
7924
8469
  const sourceGroup = this.accessor.getPanel(data.groupId);
7925
8470
  const sourceTg = sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.getTabGroups().find((tg) => tg.id === data.tabGroupId);
7926
- const groupGapWidth = avgWidth * ((_sourceTg$panelIds$le = sourceTg === null || sourceTg === void 0 ? void 0 : sourceTg.panelIds.length) !== null && _sourceTg$panelIds$le !== void 0 ? _sourceTg$panelIds$le : 1) + avgWidth;
8471
+ const groupGapSize = avgSize * ((_sourceTg$panelIds$le = sourceTg === null || sourceTg === void 0 ? void 0 : sourceTg.panelIds.length) !== null && _sourceTg$panelIds$le !== void 0 ? _sourceTg$panelIds$le : 1) + avgSize;
7927
8472
  return {
7928
8473
  sourceTabId: "",
7929
8474
  sourceIndex: -1,
7930
8475
  tabPositions: this.snapshotTabPositions(),
7931
- chipPositions: this._tabGroupManager.snapshotChipWidths(),
8476
+ chipSizes: this._tabGroupManager.snapshotChipSizes(),
7932
8477
  currentInsertionIndex: null,
7933
8478
  targetTabGroupId: null,
7934
8479
  sourceTabGroupId: data.tabGroupId,
7935
8480
  sourceGroupPanelIds: sourceTg ? new Set(sourceTg.panelIds) : /* @__PURE__ */ new Set(),
7936
- sourceChipWidth: avgWidth,
7937
- cursorOffsetFromDragLeft: groupGapWidth / 2,
7938
- sourceGapWidth: groupGapWidth,
7939
- containerLeft: this._tabsList.getBoundingClientRect().left
8481
+ sourceChipSize: avgSize,
8482
+ cursorOffsetFromDragStart: groupGapSize / 2,
8483
+ sourceGapSize: groupGapSize,
8484
+ containerStart: this._mainAxisStart(this._tabsList.getBoundingClientRect())
7940
8485
  };
7941
8486
  }
7942
8487
  /** Anim state for an external single-tab drag. */
7943
- _makeTabDragAnimState(data, avgWidth) {
8488
+ _makeTabDragAnimState(data, avgSize) {
7944
8489
  return {
7945
8490
  sourceTabId: data.panelId,
7946
8491
  sourceIndex: -1,
7947
8492
  tabPositions: this.snapshotTabPositions(),
7948
- chipPositions: this._tabGroupManager.snapshotChipWidths(),
8493
+ chipSizes: this._tabGroupManager.snapshotChipSizes(),
7949
8494
  currentInsertionIndex: null,
7950
8495
  targetTabGroupId: null,
7951
8496
  sourceTabGroupId: null,
7952
8497
  sourceGroupPanelIds: null,
7953
- sourceChipWidth: 0,
7954
- cursorOffsetFromDragLeft: avgWidth / 2,
7955
- sourceGapWidth: avgWidth,
7956
- containerLeft: this._tabsList.getBoundingClientRect().left
8498
+ sourceChipSize: 0,
8499
+ cursorOffsetFromDragStart: avgSize / 2,
8500
+ sourceGapSize: avgSize,
8501
+ containerStart: this._mainAxisStart(this._tabsList.getBoundingClientRect())
7957
8502
  };
7958
8503
  }
7959
8504
  /**
@@ -7996,19 +8541,19 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7996
8541
  container === null || container === void 0 || (_container$model = container.model) === null || _container$model === void 0 || _container$model.clear();
7997
8542
  }
7998
8543
  handleDragOver(event) {
7999
- var _this$accessor$option2;
8544
+ var _event$clientY2, _this$accessor$option2;
8000
8545
  if (!this._animState) return;
8001
8546
  if (this._wrapMode && !this._animState.sourceTabGroupId) {
8002
8547
  var _event$clientY;
8003
8548
  this.handleWrappedDragOver(event.clientX, (_event$clientY = event.clientY) !== null && _event$clientY !== void 0 ? _event$clientY : 0);
8004
8549
  return;
8005
8550
  }
8006
- const mouseX = event.clientX;
8551
+ const mousePos = this._mainAxisCoord(event.clientX, (_event$clientY2 = event.clientY) !== null && _event$clientY2 !== void 0 ? _event$clientY2 : 0);
8007
8552
  const firstPanelToGroup = this._buildFirstPanelToGroupMap();
8008
- let insertionIndex = this._computeDragOverInsertionIndex(mouseX, firstPanelToGroup);
8553
+ let insertionIndex = this._computeDragOverInsertionIndex(mousePos, firstPanelToGroup);
8009
8554
  let targetTabGroupId = null;
8010
8555
  if (insertionIndex !== null && this._tabGroupManager.chipRenderers.size > 0) {
8011
- const resolved = this._resolveInsertionAgainstTabGroups(mouseX, insertionIndex, firstPanelToGroup);
8556
+ const resolved = this._resolveInsertionAgainstTabGroups(mousePos, insertionIndex, firstPanelToGroup);
8012
8557
  insertionIndex = resolved.insertionIndex;
8013
8558
  targetTabGroupId = resolved.targetTabGroupId;
8014
8559
  }
@@ -8032,14 +8577,15 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8032
8577
  return firstPanelToGroup;
8033
8578
  }
8034
8579
  /**
8035
- * Walk the tabs left-to-right by their original widths and return the
8036
- * insertion slot for the drag image's left edge (null if no slot fits).
8580
+ * Walk the tabs in flow order by their original main-axis sizes and return
8581
+ * the insertion slot for the drag image's leading edge (null if no slot
8582
+ * fits).
8037
8583
  */
8038
- _computeDragOverInsertionIndex(mouseX, firstPanelToGroup) {
8584
+ _computeDragOverInsertionIndex(mousePos, firstPanelToGroup) {
8039
8585
  const animState = this._animState;
8040
8586
  const sourceGroupPanelIds = animState.sourceGroupPanelIds;
8041
- const availableSpace = mouseX - animState.cursorOffsetFromDragLeft - animState.containerLeft;
8042
- let accWidth = 0;
8587
+ const availableSpace = mousePos - animState.cursorOffsetFromDragStart - animState.containerStart;
8588
+ let accSize = 0;
8043
8589
  let insertionIndex = null;
8044
8590
  for (let i = 0; i < this._tabs.length; i++) {
8045
8591
  const tab = this._tabs[i].value;
@@ -8047,19 +8593,19 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8047
8593
  if (sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(tab.panel.id)) continue;
8048
8594
  const groupId = firstPanelToGroup.get(tab.panel.id);
8049
8595
  if (groupId) {
8050
- var _animState$chipPositi;
8051
- const chipWidth = (_animState$chipPositi = animState.chipPositions.get(groupId)) !== null && _animState$chipPositi !== void 0 ? _animState$chipPositi : 0;
8052
- if (accWidth + chipWidth > availableSpace) {
8596
+ var _animState$chipSizes$;
8597
+ const chipSize = (_animState$chipSizes$ = animState.chipSizes.get(groupId)) !== null && _animState$chipSizes$ !== void 0 ? _animState$chipSizes$ : 0;
8598
+ if (accSize + chipSize > availableSpace) {
8053
8599
  var _insertionIndex;
8054
8600
  (_insertionIndex = insertionIndex) !== null && _insertionIndex !== void 0 || (insertionIndex = i);
8055
8601
  break;
8056
8602
  }
8057
- accWidth += chipWidth;
8603
+ accSize += chipSize;
8058
8604
  }
8059
8605
  const origRect = animState.tabPositions.get(tab.panel.id);
8060
- const tabWidth = origRect ? origRect.width : tab.element.getBoundingClientRect().width;
8061
- if (accWidth + tabWidth / 2 <= availableSpace) {
8062
- accWidth += tabWidth;
8606
+ const tabSize = this._mainAxisSize(origRect !== null && origRect !== void 0 ? origRect : tab.element.getBoundingClientRect());
8607
+ if (accSize + tabSize / 2 <= availableSpace) {
8608
+ accSize += tabSize;
8063
8609
  insertionIndex = i + 1;
8064
8610
  } else {
8065
8611
  var _insertionIndex2;
@@ -8070,11 +8616,12 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8070
8616
  return insertionIndex;
8071
8617
  }
8072
8618
  /**
8073
- * Rebuild the accumulated original width up to `insertionIndex`, walking the
8074
- * tabs exactly the way the accumulation loop does, so callers know the
8075
- * original right edge of the chip (if any) that precedes the insertion slot.
8619
+ * Rebuild the accumulated original main-axis size up to `insertionIndex`,
8620
+ * walking the tabs exactly the way the accumulation loop does, so callers
8621
+ * know the original trailing edge of the chip (if any) that precedes the
8622
+ * insertion slot.
8076
8623
  */
8077
- _accumulatedWidthUpTo(insertionIndex, firstPanelToGroup) {
8624
+ _accumulatedSizeUpTo(insertionIndex, firstPanelToGroup) {
8078
8625
  const animState = this._animState;
8079
8626
  const sourceGroupPanelIds = animState.sourceGroupPanelIds;
8080
8627
  let accUpTo = 0;
@@ -8085,11 +8632,11 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8085
8632
  if (i >= insertionIndex) break;
8086
8633
  const gid = firstPanelToGroup.get(tab.panel.id);
8087
8634
  if (gid) {
8088
- var _animState$chipPositi2;
8089
- accUpTo += (_animState$chipPositi2 = animState.chipPositions.get(gid)) !== null && _animState$chipPositi2 !== void 0 ? _animState$chipPositi2 : 0;
8635
+ var _animState$chipSizes$2;
8636
+ accUpTo += (_animState$chipSizes$2 = animState.chipSizes.get(gid)) !== null && _animState$chipSizes$2 !== void 0 ? _animState$chipSizes$2 : 0;
8090
8637
  }
8091
8638
  const origRect = animState.tabPositions.get(tab.panel.id);
8092
- accUpTo += origRect ? origRect.width : tab.element.getBoundingClientRect().width;
8639
+ accUpTo += this._mainAxisSize(origRect !== null && origRect !== void 0 ? origRect : tab.element.getBoundingClientRect());
8093
8640
  }
8094
8641
  return accUpTo;
8095
8642
  }
@@ -8097,11 +8644,11 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8097
8644
  * Given a raw insertion index, snap it out of / into any tab group it falls
8098
8645
  * within and resolve the target group (if the drop should merge into one).
8099
8646
  */
8100
- _resolveInsertionAgainstTabGroups(mouseX, insertionIndex, firstPanelToGroup) {
8647
+ _resolveInsertionAgainstTabGroups(mousePos, insertionIndex, firstPanelToGroup) {
8101
8648
  const isGroupDrag = !!this._animState.sourceTabGroupId;
8102
- const accUpTo = this._accumulatedWidthUpTo(insertionIndex, firstPanelToGroup);
8649
+ const accUpTo = this._accumulatedSizeUpTo(insertionIndex, firstPanelToGroup);
8103
8650
  for (const tg of this.group.model.getTabGroups()) {
8104
- const resolved = this._evaluateTabGroupForInsertion(tg, mouseX, insertionIndex, accUpTo, isGroupDrag);
8651
+ const resolved = this._evaluateTabGroupForInsertion(tg, mousePos, insertionIndex, accUpTo, isGroupDrag);
8105
8652
  if (resolved) return resolved;
8106
8653
  }
8107
8654
  return {
@@ -8115,7 +8662,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8115
8662
  * group governs the slot (the caller stops iterating), or `null` when the
8116
8663
  * group is irrelevant and the caller should keep looking.
8117
8664
  */
8118
- _evaluateTabGroupForInsertion(tg, mouseX, insertionIndex, accUpTo, isGroupDrag) {
8665
+ _evaluateTabGroupForInsertion(tg, mousePos, insertionIndex, accUpTo, isGroupDrag) {
8119
8666
  const range = this._resolveGroupRange(tg);
8120
8667
  if (!range) return null;
8121
8668
  const { firstIdx, lastIdx } = range;
@@ -8123,7 +8670,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8123
8670
  const isJustBeforeGroup = !isInsideRange && insertionIndex === firstIdx - 1;
8124
8671
  if (!isInsideRange && !isJustBeforeGroup) return null;
8125
8672
  if (isGroupDrag) return this._resolveGroupDragTarget(insertionIndex, firstIdx, lastIdx, isInsideRange);
8126
- return this._resolveTabDragTarget(tg, mouseX, insertionIndex, accUpTo, firstIdx, isJustBeforeGroup);
8673
+ return this._resolveTabDragTarget(tg, mousePos, insertionIndex, accUpTo, firstIdx, isJustBeforeGroup);
8127
8674
  }
8128
8675
  /**
8129
8676
  * The index range this group occupies in the live tab list, excluding the
@@ -8158,13 +8705,13 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8158
8705
  }
8159
8706
  /** Insertion target for a single-tab drag against a group: decide whether
8160
8707
  * the drop merges into the group based on the cursor vs the chip edge. */
8161
- _resolveTabDragTarget(tg, mouseX, insertionIndex, accUpTo, firstIdx, isJustBeforeGroup) {
8162
- var _animState$chipPositi3;
8708
+ _resolveTabDragTarget(tg, mousePos, insertionIndex, accUpTo, firstIdx, isJustBeforeGroup) {
8709
+ var _animState$chipSizes$3;
8163
8710
  const animState = this._animState;
8164
- const chipWidth = (_animState$chipPositi3 = animState.chipPositions.get(tg.id)) !== null && _animState$chipPositi3 !== void 0 ? _animState$chipPositi3 : 0;
8711
+ const chipSize = (_animState$chipSizes$3 = animState.chipSizes.get(tg.id)) !== null && _animState$chipSizes$3 !== void 0 ? _animState$chipSizes$3 : 0;
8165
8712
  if (isJustBeforeGroup) {
8166
8713
  if (!this._onlySourceBetween(insertionIndex, firstIdx)) return null;
8167
- if (mouseX >= (tg.collapsed ? animState.containerLeft + accUpTo + chipWidth / 2 : animState.containerLeft + accUpTo + chipWidth)) return {
8714
+ if (mousePos >= (tg.collapsed ? animState.containerStart + accUpTo + chipSize / 2 : animState.containerStart + accUpTo + chipSize)) return {
8168
8715
  insertionIndex: firstIdx,
8169
8716
  targetTabGroupId: tg.id
8170
8717
  };
@@ -8173,10 +8720,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8173
8720
  targetTabGroupId: null
8174
8721
  };
8175
8722
  }
8176
- const chipOriginalRight = animState.containerLeft + accUpTo + chipWidth;
8723
+ const chipOriginalEnd = animState.containerStart + accUpTo + chipSize;
8177
8724
  if (insertionIndex === firstIdx) return {
8178
8725
  insertionIndex,
8179
- targetTabGroupId: mouseX >= chipOriginalRight ? tg.id : null
8726
+ targetTabGroupId: mousePos >= chipOriginalEnd ? tg.id : null
8180
8727
  };
8181
8728
  return {
8182
8729
  insertionIndex,
@@ -8339,17 +8886,17 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8339
8886
  }
8340
8887
  if (this._pendingCollapse) return;
8341
8888
  const insertionIndex = this._animState.currentInsertionIndex;
8342
- const gapWidth = this._computeGapWidth();
8889
+ const gapSize = this._computeGapSize();
8343
8890
  const chipToShift = this._computeChipToShift(insertionIndex);
8344
- this._applyGapMargins(insertionIndex, gapWidth, chipToShift, skipTransition);
8891
+ this._applyGapMargins(insertionIndex, gapSize, chipToShift, skipTransition);
8345
8892
  }
8346
- /** Gap width for the current drag: the whole group's span for a group
8347
- * drag, otherwise the source tab's own width. */
8348
- _computeGapWidth() {
8893
+ /** Gap size for the current drag: the whole group's span for a group
8894
+ * drag, otherwise the source tab's own main-axis size. */
8895
+ _computeGapSize() {
8349
8896
  const animState = this._animState;
8350
- if (animState.sourceTabGroupId && animState.sourceGroupPanelIds) return animState.sourceGapWidth;
8897
+ if (animState.sourceTabGroupId && animState.sourceGroupPanelIds) return animState.sourceGapSize;
8351
8898
  const sourceRect = animState.tabPositions.get(animState.sourceTabId);
8352
- return sourceRect ? sourceRect.width : this.getAverageTabWidth();
8899
+ return sourceRect ? this._mainAxisSize(sourceRect) : this.getAverageTabSize();
8353
8900
  }
8354
8901
  /**
8355
8902
  * When the insertion lands at or before a group's first tab, the chip is
@@ -8393,7 +8940,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8393
8940
  }
8394
8941
  /** Reset non-source chip margins, then apply the gap margin to the chip or
8395
8942
  * the first tab at/after the insertion index. */
8396
- _applyGapMargins(insertionIndex, gapWidth, chipToShift, skipTransition) {
8943
+ _applyGapMargins(insertionIndex, gapSize, chipToShift, skipTransition) {
8397
8944
  const animState = this._animState;
8398
8945
  const sourceGroupPanelIds = animState.sourceGroupPanelIds;
8399
8946
  let gapApplied = false;
@@ -8402,7 +8949,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8402
8949
  this._clearMargin(entry.chip.element, skipTransition);
8403
8950
  }
8404
8951
  if (chipToShift) {
8405
- this._setMargin(chipToShift, `${gapWidth}px`, skipTransition);
8952
+ this._setMargin(chipToShift, `${gapSize}px`, skipTransition);
8406
8953
  gapApplied = true;
8407
8954
  }
8408
8955
  for (let i = 0; i < this._tabs.length; i++) {
@@ -8410,7 +8957,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8410
8957
  if (tab.panel.id === animState.sourceTabId) continue;
8411
8958
  if (sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(tab.panel.id)) continue;
8412
8959
  if (!gapApplied && i >= insertionIndex) {
8413
- this._setMargin(tab.element, `${gapWidth}px`, skipTransition);
8960
+ this._setMargin(tab.element, `${gapSize}px`, skipTransition);
8414
8961
  gapApplied = true;
8415
8962
  } else this._clearMargin(tab.element, skipTransition);
8416
8963
  }
@@ -8420,31 +8967,33 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8420
8967
  _shiftingClass(el) {
8421
8968
  return el.classList.contains("dv-tab-group-chip") ? "dv-tab-group-chip--shifting" : "dv-tab--shifting";
8422
8969
  }
8423
- /** Apply a margin-left value to an element, optionally bypassing CSS
8970
+ /** Apply the main-axis gap margin to an element, optionally bypassing CSS
8424
8971
  * transitions for instant positioning. */
8425
8972
  _setMargin(el, value, skipTransition) {
8973
+ const property = this._gapMarginProperty;
8426
8974
  if (skipTransition) {
8427
8975
  el.style.transition = "none";
8428
- el.style.marginLeft = value;
8976
+ el.style.setProperty(property, value);
8429
8977
  el.getBoundingClientRect();
8430
8978
  el.style.removeProperty("transition");
8431
- } else el.style.marginLeft = value;
8979
+ } else el.style.setProperty(property, value);
8432
8980
  toggleClass(el, this._shiftingClass(el), true);
8433
8981
  }
8434
8982
  /** Clear an element's gap margin, animating it back to zero unless
8435
8983
  * transitions are skipped. */
8436
8984
  _clearMargin(el, skipTransition) {
8437
8985
  const cls = this._shiftingClass(el);
8986
+ const property = this._gapMarginProperty;
8438
8987
  const prev = this._pendingMarginCleanups.get(el);
8439
8988
  if (prev) prev();
8440
- if (skipTransition || !el.style.marginLeft) {
8441
- el.style.removeProperty("margin-left");
8989
+ if (skipTransition || !el.style.getPropertyValue(property)) {
8990
+ el.style.removeProperty(property);
8442
8991
  toggleClass(el, cls, false);
8443
8992
  } else {
8444
- el.style.marginLeft = "0px";
8993
+ el.style.setProperty(property, "0px");
8445
8994
  toggleClass(el, cls, true);
8446
8995
  const onEnd = () => {
8447
- el.style.removeProperty("margin-left");
8996
+ el.style.removeProperty(property);
8448
8997
  toggleClass(el, cls, false);
8449
8998
  el.removeEventListener("transitionend", onEnd);
8450
8999
  clearTimeout(fallbackTimer);
@@ -8469,6 +9018,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8469
9018
  }
8470
9019
  for (const [, entry] of this._tabGroupManager.chipRenderers) {
8471
9020
  entry.chip.element.style.removeProperty("margin-left");
9021
+ entry.chip.element.style.removeProperty("margin-top");
8472
9022
  toggleClass(entry.chip.element, "dv-tab-group-chip--shifting", false);
8473
9023
  }
8474
9024
  this._tabGroupManager.positionUnderlines();
@@ -8480,6 +9030,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8480
9030
  commitGroupMove(sourceTabGroupId, insertionIndex) {
8481
9031
  const data = getPanelData();
8482
9032
  this._tabGroupManager.disposeChipDrag(sourceTabGroupId);
9033
+ this._tabGroupManager.clearChipDropOverlays();
8483
9034
  if (this.group.model.getTabGroups().some((tg) => tg.id === sourceTabGroupId)) {
8484
9035
  var _this$accessor$option3;
8485
9036
  if (((_this$accessor$option3 = this.accessor.options.theme) === null || _this$accessor$option3 === void 0 ? void 0 : _this$accessor$option3.tabAnimation) === "smooth") {
@@ -8837,7 +9388,16 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8837
9388
  }
8838
9389
  });
8839
9390
  this._reorder = new TabReorderController(this);
8840
- this.addDisposables(this._onOverflowTabsChange, this._observerDisposable, this._pointerActivation, this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._reorder, PointerDragController.getInstance().onDragEnd((e) => {
9391
+ const tabsListPointerTarget = pointerBackend.createDropTarget(this._tabsList, {
9392
+ acceptedTargetZones: ["center"],
9393
+ canDisplayOverlay: () => false,
9394
+ isHitTestTransparent: () => {
9395
+ const data = getPanelData();
9396
+ if ((data === null || data === void 0 ? void 0 : data.viewId) !== this.accessor.id || data.groupId !== this.group.id) return true;
9397
+ return data.panelId === null && !data.tabGroupId;
9398
+ }
9399
+ });
9400
+ this.addDisposables(tabsListPointerTarget, this._onOverflowTabsChange, this._observerDisposable, this._pointerActivation, this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._reorder, PointerDragController.getInstance().onDragEnd((e) => {
8841
9401
  this._reorder.handlePointerDragEnd(e);
8842
9402
  }), PointerDragController.getInstance().onDragMove((e) => {
8843
9403
  this._reorder.handlePointerDragMove(e.clientX, e.clientY);
@@ -9053,21 +9613,21 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
9053
9613
  panel
9054
9614
  });
9055
9615
  if (((_this$accessor$option2 = this.accessor.options.theme) === null || _this$accessor$option2 === void 0 ? void 0 : _this$accessor$option2.tabAnimation) === "smooth") {
9056
- const tabWidth = tab.element.getBoundingClientRect().width;
9616
+ const tabSize = mainAxisSize(tab.element.getBoundingClientRect(), this._direction);
9057
9617
  const sourceIndex = this._tabs.findIndex((x) => x.value === tab);
9058
9618
  this._animState = {
9059
9619
  sourceTabId: panel.id,
9060
9620
  sourceIndex,
9061
9621
  tabPositions: this.snapshotTabPositions(),
9062
- chipPositions: this._tabGroupManager.snapshotChipWidths(),
9622
+ chipSizes: this._tabGroupManager.snapshotChipSizes(),
9063
9623
  currentInsertionIndex: null,
9064
9624
  targetTabGroupId: null,
9065
9625
  sourceTabGroupId: null,
9066
9626
  sourceGroupPanelIds: null,
9067
- sourceChipWidth: 0,
9068
- cursorOffsetFromDragLeft: tabWidth / 2,
9069
- sourceGapWidth: tabWidth,
9070
- containerLeft: this._tabsList.getBoundingClientRect().left
9627
+ sourceChipSize: 0,
9628
+ cursorOffsetFromDragStart: tabSize / 2,
9629
+ sourceGapSize: tabSize,
9630
+ containerStart: mainAxisStart(this._tabsList.getBoundingClientRect(), this._direction)
9071
9631
  };
9072
9632
  this._pendingCollapse = true;
9073
9633
  requestAnimationFrame(() => {
@@ -9163,7 +9723,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
9163
9723
  this._tabGroupManager.positionAllChips();
9164
9724
  if (this._animState) {
9165
9725
  this._animState.tabPositions = this.snapshotTabPositions();
9166
- this._animState.chipPositions = this._tabGroupManager.snapshotChipWidths();
9726
+ this._animState.chipSizes = this._tabGroupManager.snapshotChipSizes();
9167
9727
  this.applyDragOverTransforms();
9168
9728
  }
9169
9729
  }
@@ -9185,7 +9745,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
9185
9745
  }
9186
9746
  if (this._animState) {
9187
9747
  this._animState.tabPositions = this.snapshotTabPositions();
9188
- this._animState.chipPositions = this._tabGroupManager.snapshotChipWidths();
9748
+ this._animState.chipSizes = this._tabGroupManager.snapshotChipSizes();
9189
9749
  this.applyDragOverTransforms();
9190
9750
  }
9191
9751
  }
@@ -9263,24 +9823,24 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
9263
9823
  const firstPanelId = tabGroup.panelIds[0];
9264
9824
  const firstIdx = firstPanelId ? this._tabs.findIndex((t) => t.value.panel.id === firstPanelId) : -1;
9265
9825
  const chipRect = chip.element.getBoundingClientRect();
9266
- let groupGapWidth = chipRect.width;
9826
+ let groupGapSize = mainAxisSize(chipRect, this._direction);
9267
9827
  for (const pid of tabGroup.panelIds) {
9268
9828
  const tabEntry = this._tabMap.get(pid);
9269
- if (tabEntry) groupGapWidth += tabEntry.value.element.getBoundingClientRect().width;
9829
+ if (tabEntry) groupGapSize += mainAxisSize(tabEntry.value.element.getBoundingClientRect(), this._direction);
9270
9830
  }
9271
9831
  this._animState = {
9272
9832
  sourceTabId: "",
9273
9833
  sourceIndex: firstIdx,
9274
9834
  tabPositions: this.snapshotTabPositions(),
9275
- chipPositions: this._tabGroupManager.snapshotChipWidths(),
9835
+ chipSizes: this._tabGroupManager.snapshotChipSizes(),
9276
9836
  currentInsertionIndex: null,
9277
9837
  targetTabGroupId: null,
9278
9838
  sourceTabGroupId: tabGroup.id,
9279
9839
  sourceGroupPanelIds: new Set(tabGroup.panelIds),
9280
- sourceChipWidth: chipRect.width,
9281
- cursorOffsetFromDragLeft: event.clientX - chipRect.left,
9282
- sourceGapWidth: groupGapWidth,
9283
- containerLeft: this._tabsList.getBoundingClientRect().left
9840
+ sourceChipSize: mainAxisSize(chipRect, this._direction),
9841
+ cursorOffsetFromDragStart: mainAxisCursor(event, this._direction) - mainAxisStart(chipRect, this._direction),
9842
+ sourceGapSize: groupGapSize,
9843
+ containerStart: mainAxisStart(this._tabsList.getBoundingClientRect(), this._direction)
9284
9844
  };
9285
9845
  if (((_this$accessor$option4 = this.accessor.options.theme) === null || _this$accessor$option4 === void 0 ? void 0 : _this$accessor$option4.tabAnimation) !== "smooth") return;
9286
9846
  const groupPanelIds = new Set(tabGroup.panelIds);
@@ -9313,6 +9873,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
9313
9873
  * (when the source tab is currently to the left of the target slot, its
9314
9874
  * removal shifts the insertion index down by one). Always clears
9315
9875
  * `targetTabGroupId` so the dropped tab lands outside the group.
9876
+ *
9877
+ * A chip dropped on a chip is a group move: the panel path would route it
9878
+ * through the cross-group machinery, which rebuilds the tab group under a
9879
+ * new id.
9316
9880
  */
9317
9881
  _handleChipDrop(tabGroup, event) {
9318
9882
  const firstPanelId = tabGroup.panelIds[0];
@@ -9320,6 +9884,14 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
9320
9884
  const insertionIndex = this._tabs.findIndex((x) => x.value.panel.id === firstPanelId);
9321
9885
  if (insertionIndex === -1) return;
9322
9886
  const data = getPanelData();
9887
+ if (data === null || data === void 0 ? void 0 : data.tabGroupId) {
9888
+ var _animState$currentIns2;
9889
+ const animState = this._animState;
9890
+ this._animState = null;
9891
+ this._pendingCollapse = false;
9892
+ this._commitGroupMove(data.tabGroupId, (_animState$currentIns2 = animState === null || animState === void 0 ? void 0 : animState.currentInsertionIndex) !== null && _animState$currentIns2 !== void 0 ? _animState$currentIns2 : insertionIndex);
9893
+ return;
9894
+ }
9323
9895
  const sourceIndex = (data === null || data === void 0 ? void 0 : data.groupId) === this.group.id && (data === null || data === void 0 ? void 0 : data.panelId) ? this._tabs.findIndex((x) => x.value.panel.id === data.panelId) : -1;
9324
9896
  const adjustedIndex = insertionIndex - (sourceIndex !== -1 && sourceIndex < insertionIndex ? 1 : 0);
9325
9897
  this._onDrop.fire({
@@ -10026,8 +10598,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
10026
10598
  return this.tabsContainer.getPanelForTab(element);
10027
10599
  }
10028
10600
  get isContentFocused() {
10029
- if (!document.activeElement) return false;
10030
- return isAncestor(document.activeElement, this.contentContainer.element);
10601
+ const element = this.contentContainer.element;
10602
+ const activeElement = getActiveElement(element);
10603
+ if (!activeElement) return false;
10604
+ return isAncestor(activeElement, element);
10031
10605
  }
10032
10606
  get headerPosition() {
10033
10607
  var _this$_headerPosition;
@@ -12938,6 +13512,12 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
12938
13512
  observer.observe(gridview.element);
12939
13513
  return { dispose: () => observer.disconnect() };
12940
13514
  }
13515
+ /**
13516
+ * Runs `work` after `delayMs`, resolving once it has finished. Work that
13517
+ * returns a promise is awaited, so a caller holding
13518
+ * `restorationPromise` waits for the popout window itself rather than
13519
+ * only for the timer that starts it.
13520
+ */
12941
13521
  scheduleRestoration(delayMs, work, onCancel) {
12942
13522
  return new Promise((resolve) => {
12943
13523
  const cleanup = () => {
@@ -12952,8 +13532,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
12952
13532
  resolve();
12953
13533
  return;
12954
13534
  }
12955
- work();
12956
- resolve();
13535
+ Promise.resolve(work()).then(() => resolve(), () => resolve());
12957
13536
  }, delayMs);
12958
13537
  this._restorationCleanups.add(cleanup);
12959
13538
  });
@@ -14211,188 +14790,6 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
14211
14790
  }
14212
14791
  };
14213
14792
 
14214
- //#endregion
14215
- //#region \0@oxc-project+runtime@0.139.0/helpers/esm/asyncToGenerator.js
14216
- function asyncGeneratorStep(n, t, e, r, o, a, c) {
14217
- try {
14218
- var i = n[a](c), u = i.value;
14219
- } catch (n) {
14220
- e(n);
14221
- return;
14222
- }
14223
- i.done ? t(u) : Promise.resolve(u).then(r, o);
14224
- }
14225
- function _asyncToGenerator(n) {
14226
- return function() {
14227
- var t = this, e = arguments;
14228
- return new Promise(function(r, o) {
14229
- var a = n.apply(t, e);
14230
- function _next(n) {
14231
- asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
14232
- }
14233
- function _throw(n) {
14234
- asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
14235
- }
14236
- _next(void 0);
14237
- });
14238
- };
14239
- }
14240
-
14241
- //#endregion
14242
- //#region src/popoutWindow.ts
14243
- /**
14244
- * Reject popout URLs that aren't same-origin http(s). Blocks `javascript:`,
14245
- * `data:`, `blob:`, `vbscript:`, and cross-origin URLs that would otherwise
14246
- * execute in a context the browser still associates with the opener via
14247
- * `window.opener`.
14248
- */
14249
- function assertSameOriginPopoutUrl(url) {
14250
- let resolved;
14251
- try {
14252
- resolved = new URL(url, globalThis.location.href);
14253
- } catch (_unused) {
14254
- throw new Error(`dockview: invalid popout URL: ${url}`);
14255
- }
14256
- if (!(resolved.protocol === "http:" || resolved.protocol === "https:") || resolved.origin !== globalThis.location.origin) throw new Error(`dockview: popout URL must be same-origin http(s); got: ${url}`);
14257
- }
14258
- var PopoutWindow = class extends CompositeDisposable {
14259
- get window() {
14260
- var _this$_window$value, _this$_window;
14261
- return (_this$_window$value = (_this$_window = this._window) === null || _this$_window === void 0 ? void 0 : _this$_window.value) !== null && _this$_window$value !== void 0 ? _this$_window$value : null;
14262
- }
14263
- constructor(target, className, options) {
14264
- super();
14265
- this.target = target;
14266
- this.className = className;
14267
- this.options = options;
14268
- this._onWillClose = new Emitter();
14269
- this.onWillClose = this._onWillClose.event;
14270
- this._onDidClose = new Emitter();
14271
- this.onDidClose = this._onDidClose.event;
14272
- this._window = null;
14273
- this.addDisposables(this._onWillClose, this._onDidClose, { dispose: () => {
14274
- this.close();
14275
- } });
14276
- }
14277
- dimensions() {
14278
- if (!this._window) return null;
14279
- const left = this._window.value.screenX;
14280
- return {
14281
- top: this._window.value.screenY,
14282
- left,
14283
- width: this._window.value.innerWidth,
14284
- height: this._window.value.innerHeight
14285
- };
14286
- }
14287
- close() {
14288
- if (this._window) {
14289
- var _this$options$onWillC, _this$options;
14290
- this._onWillClose.fire();
14291
- (_this$options$onWillC = (_this$options = this.options).onWillClose) === null || _this$options$onWillC === void 0 || _this$options$onWillC.call(_this$options, {
14292
- id: this.target,
14293
- window: this._window.value
14294
- });
14295
- this._window.disposable.dispose();
14296
- this._window = null;
14297
- this._onDidClose.fire();
14298
- }
14299
- }
14300
- open() {
14301
- var _this = this;
14302
- return _asyncToGenerator(function* () {
14303
- var _this$options$onDidOp, _this$options2;
14304
- if (_this._window) throw new Error("instance of popout window is already open");
14305
- const url = `${_this.options.url}`;
14306
- assertSameOriginPopoutUrl(url);
14307
- const features = Object.entries({
14308
- top: _this.options.top,
14309
- left: _this.options.left,
14310
- width: _this.options.width,
14311
- height: _this.options.height
14312
- }).map(([key, value]) => `${key}=${value}`).join(",");
14313
- /**
14314
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open
14315
- */
14316
- const externalWindow = window.open(url, _this.target, features);
14317
- if (!externalWindow)
14318
- /**
14319
- * Popup blocked
14320
- */
14321
- return null;
14322
- const disposable = new CompositeDisposable();
14323
- _this._window = {
14324
- value: externalWindow,
14325
- disposable
14326
- };
14327
- disposable.addDisposables(Disposable.from(() => {
14328
- externalWindow.close();
14329
- }), addDisposableListener(globalThis.window, "beforeunload", () => {
14330
- /**
14331
- * before the main window closes we should close this popup too
14332
- * to be good citizens
14333
- *
14334
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
14335
- */
14336
- _this.close();
14337
- }));
14338
- const container = _this.createPopoutWindowContainer();
14339
- if (_this.className) container.classList.add(_this.className);
14340
- (_this$options$onDidOp = (_this$options2 = _this.options).onDidOpen) === null || _this$options$onDidOp === void 0 || _this$options$onDidOp.call(_this$options2, {
14341
- id: _this.target,
14342
- window: externalWindow
14343
- });
14344
- return new Promise((resolve, reject) => {
14345
- externalWindow.addEventListener("unload", () => {});
14346
- /**
14347
- * `load` is the only event that resolves this promise with a
14348
- * container, so a window that goes away first would leave the
14349
- * caller awaiting a promise that never settles - and
14350
- * `addPopoutGroup` holds its layout transaction open until it does.
14351
- * Settle with `null` on close, the same signal a blocked popup
14352
- * gives and one the caller already handles. `resolve` after the
14353
- * fact is a no-op, so a `load` that arrived first still wins.
14354
- */
14355
- disposable.addDisposables(_this.onWillClose(() => resolve(null)));
14356
- externalWindow.addEventListener("load", () => {
14357
- /**
14358
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
14359
- */
14360
- try {
14361
- const externalDocument = externalWindow.document;
14362
- externalDocument.title = document.title;
14363
- externalDocument.body.appendChild(container);
14364
- addStyles(externalDocument, globalThis.document.styleSheets, { nonce: _this.options.nonce });
14365
- /**
14366
- * beforeunload must be registered after load for reasons I could not determine
14367
- * otherwise the beforeunload event will not fire when the window is closed
14368
- */
14369
- addDisposableListener(externalWindow, "beforeunload", () => {
14370
- /**
14371
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
14372
- */
14373
- _this.close();
14374
- });
14375
- resolve(container);
14376
- } catch (err) {
14377
- reject(err);
14378
- }
14379
- });
14380
- });
14381
- })();
14382
- }
14383
- createPopoutWindowContainer() {
14384
- const el = document.createElement("div");
14385
- el.classList.add("dv-popout-window");
14386
- el.id = "dv-popout-window";
14387
- el.style.position = "absolute";
14388
- el.style.width = "100%";
14389
- el.style.height = "100%";
14390
- el.style.top = "0px";
14391
- el.style.left = "0px";
14392
- return el;
14393
- }
14394
- };
14395
-
14396
14793
  //#endregion
14397
14794
  //#region src/dockview/strictEventsSequencing.ts
14398
14795
  var StrictEventsSequencing = class extends CompositeDisposable {
@@ -14436,8 +14833,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
14436
14833
  * peeks): while it lives it watches a configurable set of dismiss signals
14437
14834
  * (Escape / extra keys, outside-pointerdown with an optional grace window,
14438
14835
  * window resize, focus moving outside) and calls `onDismiss`. Inside/outside is
14439
- * decided by an `isInside` predicate (geometry) or a `contains` check against
14440
- * `elements`. Dispose to detach every listener.
14836
+ * decided by an `isInside` predicate (geometry) or by checking the event's
14837
+ * composed path against `elements`. Dispose to detach every listener.
14441
14838
  *
14442
14839
  * It owns only the *signals*, not the surface element, its position, or any
14443
14840
  * hover/keep-open policy, so callers keep their own element lifecycle and
@@ -14457,9 +14854,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
14457
14854
  const isInside = (event) => {
14458
14855
  var _options$elements, _options$elements2;
14459
14856
  if (options.isInside) return options.isInside(event);
14460
- const target = event.target;
14461
- if (!(target instanceof Node)) return false;
14462
- return ((_options$elements = (_options$elements2 = options.elements) === null || _options$elements2 === void 0 ? void 0 : _options$elements2.call(options)) !== null && _options$elements !== void 0 ? _options$elements : []).some((el) => el.contains(target));
14857
+ return isEventWithin(event, (_options$elements = (_options$elements2 = options.elements) === null || _options$elements2 === void 0 ? void 0 : _options$elements2.call(options)) !== null && _options$elements !== void 0 ? _options$elements : []);
14463
14858
  };
14464
14859
  if (escape || keys.length > 0) disposables.addDisposables(addDisposableListener(win, "keydown", (event) => {
14465
14860
  if (escape && event.key === "Escape" || keys.includes(event.key)) options.onDismiss();
@@ -14478,17 +14873,45 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
14478
14873
  options.onDismiss();
14479
14874
  }));
14480
14875
  if (options.focusOut) {
14481
- const isFocusInside = (focused) => {
14482
- var _options$elements3, _options$elements4;
14483
- if (options.isFocusInside) return options.isFocusInside(focused);
14484
- return ((_options$elements3 = (_options$elements4 = options.elements) === null || _options$elements4 === void 0 ? void 0 : _options$elements4.call(options)) !== null && _options$elements3 !== void 0 ? _options$elements3 : []).some((el) => el.contains(focused));
14876
+ /** A node in the layer's own tree, to scope retargeting and to locate
14877
+ * the shadow roots to listen on. */
14878
+ const layerScope = () => {
14879
+ var _options$anchor, _options$anchor2, _options$elements3;
14880
+ return (_options$anchor = (_options$anchor2 = options.anchor) === null || _options$anchor2 === void 0 ? void 0 : _options$anchor2.call(options)) !== null && _options$anchor !== void 0 ? _options$anchor : (_options$elements3 = options.elements) === null || _options$elements3 === void 0 ? void 0 : _options$elements3.call(options)[0];
14485
14881
  };
14882
+ const seen = /* @__PURE__ */ new WeakSet();
14486
14883
  const onFocusIn = (event) => {
14884
+ var _options$elements4, _options$elements5;
14885
+ if (seen.has(event)) return;
14886
+ seen.add(event);
14487
14887
  const target = event.target;
14488
- if (target instanceof Element && !isFocusInside(target)) options.onDismiss();
14888
+ if (!(target instanceof Element)) return;
14889
+ if (!(options.isFocusInside ? options.isFocusInside(retargetInto(target, layerScope())) : isEventWithin(event, (_options$elements4 = (_options$elements5 = options.elements) === null || _options$elements5 === void 0 ? void 0 : _options$elements5.call(options)) !== null && _options$elements4 !== void 0 ? _options$elements4 : []))) options.onDismiss();
14489
14890
  };
14490
- win.addEventListener("focusin", onFocusIn, capture);
14491
- disposables.addDisposables({ dispose: () => win.removeEventListener("focusin", onFocusIn, capture) });
14891
+ const bound = /* @__PURE__ */ new Map();
14892
+ const syncShadowRoots = () => {
14893
+ var _options$anchor3, _options$elements6, _options$elements7;
14894
+ const wanted = /* @__PURE__ */ new Set();
14895
+ const anchor = (_options$anchor3 = options.anchor) === null || _options$anchor3 === void 0 ? void 0 : _options$anchor3.call(options);
14896
+ const sources = [...(_options$elements6 = (_options$elements7 = options.elements) === null || _options$elements7 === void 0 ? void 0 : _options$elements7.call(options)) !== null && _options$elements6 !== void 0 ? _options$elements6 : [], ...anchor ? [anchor] : []];
14897
+ for (const node of sources) for (const root of shadowRootsOf(node)) wanted.add(root);
14898
+ for (const [root, listener] of bound) if (!wanted.has(root)) {
14899
+ listener.dispose();
14900
+ bound.delete(root);
14901
+ }
14902
+ for (const root of wanted) {
14903
+ if (bound.has(root)) continue;
14904
+ bound.set(root, addDisposableListener(root, "focusin", onFocusIn, capture));
14905
+ }
14906
+ };
14907
+ disposables.addDisposables(addDisposableListener(win, "focusin", (event) => {
14908
+ syncShadowRoots();
14909
+ onFocusIn(event);
14910
+ }, capture), { dispose: () => {
14911
+ for (const [, listener] of bound) listener.dispose();
14912
+ bound.clear();
14913
+ } });
14914
+ syncShadowRoots();
14492
14915
  }
14493
14916
  return disposables;
14494
14917
  }
@@ -14981,6 +15404,24 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
14981
15404
  this.updateTheme(this._gap, this._defaultCollapsedSize);
14982
15405
  return view;
14983
15406
  }
15407
+ /**
15408
+ * Lay out from the shell's current size.
15409
+ *
15410
+ * The ResizeObserver above only reports asynchronously, so between
15411
+ * construction and its first callback the shell believes it has no size -
15412
+ * and any layout built in that window (panels added straight after
15413
+ * `createDockview`, say) resolves its sizes against zero and collapses to
15414
+ * minimums, permanently. Seeding the size synchronously gives that work
15415
+ * the real dimensions. Same guards as the observer: a detached or hidden
15416
+ * shell has no size worth propagating.
15417
+ */
15418
+ layoutFromElement() {
15419
+ if (!this._shellElement.offsetParent || !isInDocument(this._shellElement)) return;
15420
+ const width = Math.round(this._shellElement.clientWidth);
15421
+ const height = Math.round(this._shellElement.clientHeight);
15422
+ if (width === 0 || height === 0) return;
15423
+ this.layout(width, height);
15424
+ }
14984
15425
  layout(width, height) {
14985
15426
  this._outerSplitview.layout(width, height);
14986
15427
  this._flushPendingSizes();
@@ -15240,6 +15681,15 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
15240
15681
 
15241
15682
  //#endregion
15242
15683
  //#region src/dockview/dockviewComponent.ts
15684
+ /**
15685
+ * An error says the most about why, so it wins; a blocked window has none, and
15686
+ * its usual cause is more useful than its name.
15687
+ */
15688
+ function logFailedPopout(failure) {
15689
+ if (failure.error) console.error("dockview: failed to create popout.", failure.error);
15690
+ else if (failure.reason === "blocked") console.error("dockview: failed to create popout. perhaps you need to allow pop-ups for this website");
15691
+ else console.error(`dockview: failed to create popout (${failure.reason}).`);
15692
+ }
15243
15693
  function buildTabGroupColorPalette(options) {
15244
15694
  var _options$tabGroupColo;
15245
15695
  return new TabGroupColorPalette((_options$tabGroupColo = options.tabGroupColors) !== null && _options$tabGroupColo !== void 0 ? _options$tabGroupColo : DEFAULT_TAB_GROUP_COLORS, options.tabGroupAccent !== "off");
@@ -15291,6 +15741,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
15291
15741
  get panels() {
15292
15742
  return this.groups.flatMap((group) => group.panels);
15293
15743
  }
15744
+ /** `dndStrategy` resolved against this device; see `DockviewApi`. */
15745
+ get dndCapabilities() {
15746
+ return resolveDndCapabilities(this.options);
15747
+ }
15294
15748
  get options() {
15295
15749
  return this._options;
15296
15750
  }
@@ -15800,9 +16254,9 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
15800
16254
  return (_this$_popoutWindowSe = (_this$_popoutWindowSe2 = this._popoutWindowService) === null || _this$_popoutWindowSe2 === void 0 ? void 0 : _this$_popoutWindowSe2.restorationPromise) !== null && _this$_popoutWindowSe !== void 0 ? _this$_popoutWindowSe : Promise.resolve();
15801
16255
  }
15802
16256
  constructor(container, options) {
15803
- var _options$theme$gap, _options$theme, _options$theme$gap2, _options$theme2, _options$theme3;
16257
+ var _options$proportional, _options$theme$gap, _options$theme, _options$theme$gap2, _options$theme2, _options$theme3;
15804
16258
  super(container, {
15805
- proportionalLayout: true,
16259
+ proportionalLayout: (_options$proportional = options.proportionalLayout) !== null && _options$proportional !== void 0 ? _options$proportional : true,
15806
16260
  orientation: "HORIZONTAL",
15807
16261
  styles: options.hideBorders ? { separatorBorder: "transparent" } : void 0,
15808
16262
  disableAutoResizing: options.disableAutoResizing,
@@ -15849,6 +16303,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
15849
16303
  this.onDidChangePopouts = this._onDidChangePopouts.event;
15850
16304
  this._onDidOpenPopoutWindowFail = new Emitter();
15851
16305
  this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
16306
+ this._onWillClosePopoutWindow = new Emitter();
16307
+ this.onWillClosePopoutWindow = this._onWillClosePopoutWindow.event;
15852
16308
  this._onDidStartFloatingGroupDrag = new Emitter();
15853
16309
  this.onDidStartFloatingGroupDrag = this._onDidStartFloatingGroupDrag.event;
15854
16310
  this._onDidEndFloatingGroupDrag = new Emitter();
@@ -15950,7 +16406,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
15950
16406
  var _this$_shellManager2;
15951
16407
  this._moduleRegistry.dispose();
15952
16408
  (_this$_shellManager2 = this._shellManager) === null || _this$_shellManager2 === void 0 || _this$_shellManager2.dispose();
15953
- }));
16409
+ }), this._onWillClosePopoutWindow);
15954
16410
  const rootDropTarget = this._rootDropTargetService;
15955
16411
  if (rootDropTarget) this.addDisposables(rootDropTarget.onWillShowOverlay((event) => {
15956
16412
  if (this.gridview.length > 0 && event.position === "center") return;
@@ -15963,6 +16419,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
15963
16419
  }));
15964
16420
  }), rootDropTarget.onDrop((event) => this.dockToLayoutEdge(event.nativeEvent, event.position)));
15965
16421
  this._moduleRegistry.postConstruct(this);
16422
+ this._shellManager.layoutFromElement();
15966
16423
  }
15967
16424
  setVisible(panel, visible) {
15968
16425
  switch (panel.api.location.type) {
@@ -16032,22 +16489,36 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16032
16489
  const box = getBox();
16033
16490
  const groupId = (_options$overridePopo = options === null || options === void 0 || (_options$overridePopo2 = options.overridePopoutGroup) === null || _options$overridePopo2 === void 0 ? void 0 : _options$overridePopo2.id) !== null && _options$overridePopo !== void 0 ? _options$overridePopo : this.getNextGroupId();
16034
16491
  const resolvedPopoutUrl = (_options$popoutUrl = options === null || options === void 0 ? void 0 : options.popoutUrl) !== null && _options$popoutUrl !== void 0 ? _options$popoutUrl : (_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.popoutUrl;
16492
+ const popoutUrl = resolvedPopoutUrl !== null && resolvedPopoutUrl !== void 0 ? resolvedPopoutUrl : "/popout.html";
16035
16493
  const _window = new PopoutWindow(`${this.id}-${groupId}`, theme !== null && theme !== void 0 ? theme : "", {
16036
- url: resolvedPopoutUrl !== null && resolvedPopoutUrl !== void 0 ? resolvedPopoutUrl : "/popout.html",
16494
+ url: popoutUrl,
16037
16495
  left: box.left,
16038
16496
  top: box.top,
16039
16497
  width: box.width,
16040
16498
  height: box.height,
16041
16499
  onDidOpen: options === null || options === void 0 ? void 0 : options.onDidOpen,
16042
- onWillClose: options === null || options === void 0 ? void 0 : options.onWillClose,
16043
- nonce: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.nonce
16500
+ onWillClose: (event) => {
16501
+ var _options$onWillClose;
16502
+ options === null || options === void 0 || (_options$onWillClose = options.onWillClose) === null || _options$onWillClose === void 0 || _options$onWillClose.call(options, event);
16503
+ this._onWillClosePopoutWindow.fire(event);
16504
+ },
16505
+ nonce: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.nonce,
16506
+ styleRoot: () => this.element.getRootNode()
16044
16507
  });
16045
16508
  const popoutWindowDisposable = new CompositeDisposable(_window, _window.onDidClose(() => {
16046
16509
  popoutWindowDisposable.dispose();
16047
16510
  }));
16048
- return _window.open().then((popoutContainer) => {
16511
+ const openError = getPopoutUrlError(popoutUrl);
16512
+ return (openError ? Promise.resolve(null) : _window.open()).then((popoutContainer) => {
16049
16513
  var _options$referenceGro, _options$overridePopo4;
16050
- if (_window.isDisposed) return false;
16514
+ if (_window.isDisposed) {
16515
+ const failure = _window.failure;
16516
+ if (failure && !this.isDisposed) {
16517
+ logFailedPopout(failure);
16518
+ this._onDidOpenPopoutWindowFail.fire(failure);
16519
+ }
16520
+ return false;
16521
+ }
16051
16522
  const referenceGroup = (_options$referenceGro = options === null || options === void 0 ? void 0 : options.referenceGroup) !== null && _options$referenceGro !== void 0 ? _options$referenceGro : itemToPopout instanceof DockviewPanel ? itemToPopout.group : itemToPopout;
16052
16523
  const referenceLocation = itemToPopout.api.location.type;
16053
16524
  /**
@@ -16066,11 +16537,16 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16066
16537
  if (popoutContainer) this._onDidAddGroup.fire(group);
16067
16538
  }
16068
16539
  if (popoutContainer === null) {
16540
+ var _window$failure;
16069
16541
  this.handleBlockedPopout({
16070
16542
  group,
16071
16543
  referenceGroup,
16072
16544
  options,
16073
- popoutWindowDisposable
16545
+ popoutWindowDisposable,
16546
+ failure: openError ? {
16547
+ reason: "url-refused",
16548
+ error: openError
16549
+ } : (_window$failure = _window.failure) !== null && _window$failure !== void 0 ? _window$failure : { reason: "blocked" }
16074
16550
  });
16075
16551
  return false;
16076
16552
  }
@@ -16233,16 +16709,17 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16233
16709
  });
16234
16710
  }
16235
16711
  /**
16236
- * The popout window was blocked (e.g. by the browser's popup blocker,
16237
- * common when restoring popouts on load). Fall back gracefully so the
16238
- * group(s) end up valid and visible in the main grid rather than as
16239
- * orphans that later crash clear()/remove().
16712
+ * The popout window never opened - blocked by the browser's popup blocker
16713
+ * (common when restoring popouts on load), or refused outright because its
16714
+ * URL failed the same-origin guard. Fall back gracefully so the group(s)
16715
+ * end up valid and visible in the main grid rather than as orphans that
16716
+ * render nothing and later crash clear()/remove().
16240
16717
  */
16241
16718
  handleBlockedPopout(params) {
16242
- const { group, referenceGroup, options, popoutWindowDisposable } = params;
16243
- console.error("dockview: failed to create popout. perhaps you need to allow pop-ups for this website");
16719
+ const { group, referenceGroup, options, popoutWindowDisposable, failure } = params;
16720
+ logFailedPopout(failure);
16244
16721
  popoutWindowDisposable.dispose();
16245
- this._onDidOpenPopoutWindowFail.fire();
16722
+ this._onDidOpenPopoutWindowFail.fire(failure);
16246
16723
  if (options === null || options === void 0 ? void 0 : options.overridePopoutGridview) {
16247
16724
  const blockedGridview = options.overridePopoutGridview;
16248
16725
  const members = this.groups.filter((candidate) => blockedGridview.element.contains(candidate.element));
@@ -16397,10 +16874,11 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16397
16874
  group = this.createGroup();
16398
16875
  this._onDidAddGroup.fire(group);
16399
16876
  this.movingLock(() => this.removePanel(item, {
16400
- removeEmptyGroup: true,
16877
+ removeEmptyGroup: false,
16401
16878
  skipDispose: true,
16402
16879
  skipSetActiveGroup: true
16403
16880
  }));
16881
+ this.removeGroupIfEmpty(sourceGroup);
16404
16882
  this.movingLock(() => group.model.openPanel(item, { skipSetGroupActive: true }));
16405
16883
  movedPanels = [{
16406
16884
  panel: item,
@@ -16471,13 +16949,17 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16471
16949
  });
16472
16950
  for (const { panel, from } of movedPanels) this.fireDidMovePanel(panel, from);
16473
16951
  }
16952
+ removeGroupIfEmpty(group) {
16953
+ if (group.model.size === 0) this.doRemoveGroup(group, { skipActive: true });
16954
+ }
16474
16955
  /**
16475
- * Build an empty gridview configured to match the main grid's styling, for
16476
- * hosting a nested layout inside a floating or popout window.
16956
+ * Build an empty gridview configured to match the main grid's styling and
16957
+ * resize behaviour, for hosting a nested layout inside a floating or popout
16958
+ * window.
16477
16959
  */
16478
16960
  createNestedGridview(orientation = "HORIZONTAL") {
16479
16961
  var _this$options$theme$g, _this$options$theme2;
16480
- return new Gridview(true, this.options.hideBorders ? { separatorBorder: "transparent" } : void 0, orientation, false, (_this$options$theme$g = (_this$options$theme2 = this.options.theme) === null || _this$options$theme2 === void 0 ? void 0 : _this$options$theme2.gap) !== null && _this$options$theme$g !== void 0 ? _this$options$theme$g : 0);
16962
+ return new Gridview(this.gridview.proportionalLayout, this.options.hideBorders ? { separatorBorder: "transparent" } : void 0, orientation, false, (_this$options$theme$g = (_this$options$theme2 = this.options.theme) === null || _this$options$theme2 === void 0 ? void 0 : _this$options$theme2.gap) !== null && _this$options$theme$g !== void 0 ? _this$options$theme$g : 0);
16481
16963
  }
16482
16964
  /**
16483
16965
  * Wrap a (populated) floating gridview in an overlay window: title bar /
@@ -16550,6 +17032,12 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16550
17032
  const newDisableDnd = this.options.disableDnd;
16551
17033
  const newDndStrategy = this.options.dndStrategy;
16552
17034
  if (oldDisableDnd !== newDisableDnd || oldDndStrategy !== newDndStrategy) this.updateDragAndDropState();
17035
+ if ("proportionalLayout" in options) {
17036
+ var _this$_popoutWindowSe9, _this$_popoutWindowSe10;
17037
+ const proportionalLayout = this.gridview.proportionalLayout;
17038
+ for (const floating of this.floatingGroups) floating.gridview.proportionalLayout = proportionalLayout;
17039
+ for (const entry of (_this$_popoutWindowSe9 = (_this$_popoutWindowSe10 = this._popoutWindowService) === null || _this$_popoutWindowSe10 === void 0 ? void 0 : _this$_popoutWindowSe10.entries) !== null && _this$_popoutWindowSe9 !== void 0 ? _this$_popoutWindowSe9 : []) entry.gridview.proportionalLayout = proportionalLayout;
17040
+ }
16553
17041
  if ("theme" in options) this.updateTheme();
16554
17042
  if ("createRightHeaderActionComponent" in options || "createLeftHeaderActionComponent" in options || "createPrefixHeaderActionComponent" in options) {
16555
17043
  var _this$headerActionsSe;
@@ -16857,14 +17345,14 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16857
17345
  * @returns A JSON respresentation of the layout
16858
17346
  */
16859
17347
  toJSON() {
16860
- var _this$_floatingGroupS3, _this$_floatingGroupS4, _this$_popoutWindowSe9, _this$_popoutWindowSe10, _this$activeGroup2;
17348
+ var _this$_floatingGroupS3, _this$_floatingGroupS4, _this$_popoutWindowSe11, _this$_popoutWindowSe12, _this$activeGroup2;
16861
17349
  const data = this.gridview.serialize();
16862
17350
  const panels = this.panels.reduce((collection, panel) => {
16863
17351
  collection[panel.id] = panel.toJSON();
16864
17352
  return collection;
16865
17353
  }, {});
16866
17354
  const floats = (_this$_floatingGroupS3 = (_this$_floatingGroupS4 = this._floatingGroupService) === null || _this$_floatingGroupS4 === void 0 ? void 0 : _this$_floatingGroupS4.serialize()) !== null && _this$_floatingGroupS3 !== void 0 ? _this$_floatingGroupS3 : [];
16867
- const popoutGroups = (_this$_popoutWindowSe9 = (_this$_popoutWindowSe10 = this._popoutWindowService) === null || _this$_popoutWindowSe10 === void 0 ? void 0 : _this$_popoutWindowSe10.serialize()) !== null && _this$_popoutWindowSe9 !== void 0 ? _this$_popoutWindowSe9 : [];
17355
+ const popoutGroups = (_this$_popoutWindowSe11 = (_this$_popoutWindowSe12 = this._popoutWindowService) === null || _this$_popoutWindowSe12 === void 0 ? void 0 : _this$_popoutWindowSe12.serialize()) !== null && _this$_popoutWindowSe11 !== void 0 ? _this$_popoutWindowSe11 : [];
16868
17356
  const result = {
16869
17357
  grid: data,
16870
17358
  panels,
@@ -16903,8 +17391,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16903
17391
  this.mutation("load", () => this._doFromJSON(data, options));
16904
17392
  }
16905
17393
  _doFromJSON(data, options) {
16906
- var _this$_popoutWindowSe11, _data$grid$root;
16907
- (_this$_popoutWindowSe11 = this._popoutWindowService) === null || _this$_popoutWindowSe11 === void 0 || _this$_popoutWindowSe11.cancelPendingRestorations();
17394
+ var _this$_popoutWindowSe13, _data$grid$root;
17395
+ (_this$_popoutWindowSe13 = this._popoutWindowService) === null || _this$_popoutWindowSe13 === void 0 || _this$_popoutWindowSe13.cancelPendingRestorations();
16908
17396
  if (typeof data !== "object" || data === null) throw new Error("dockview: serialized layout must be a non-null object");
16909
17397
  if (!data.grid || ((_data$grid$root = data.grid.root) === null || _data$grid$root === void 0 ? void 0 : _data$grid$root.type) !== "branch" || !Array.isArray(data.grid.root.data)) throw new Error("dockview: root must be of type branch");
16910
17398
  const existingPanels = /* @__PURE__ */ new Map();
@@ -17023,7 +17511,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17023
17511
  } else this.clear();
17024
17512
  const { grid, panels, activeGroup } = data;
17025
17513
  try {
17026
- var _data$floatingGroups, _data$popoutGroups, _this$_popoutWindowSe12, _this$_floatingGroupS5, _this$_watermarkServi2;
17514
+ var _data$floatingGroups, _data$popoutGroups, _this$_popoutWindowSe14, _this$_floatingGroupS5, _this$_watermarkServi2;
17027
17515
  const width = this.width;
17028
17516
  const height = this.height;
17029
17517
  const createGroupFromSerializedState = (data) => {
@@ -17088,7 +17576,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17088
17576
  if (data.edgeGroups) this.deserializeEdgeGroups(data.edgeGroups, panels, existingPanels, temporaryGroups);
17089
17577
  this.deserializeFloatingWindows((_data$floatingGroups = data.floatingGroups) !== null && _data$floatingGroups !== void 0 ? _data$floatingGroups : [], createGroupFromSerializedState);
17090
17578
  const popoutPromises = this.deserializePopoutWindows((_data$popoutGroups = data.popoutGroups) !== null && _data$popoutGroups !== void 0 ? _data$popoutGroups : [], createGroupFromSerializedState);
17091
- (_this$_popoutWindowSe12 = this._popoutWindowService) === null || _this$_popoutWindowSe12 === void 0 || _this$_popoutWindowSe12.finishRestoration(popoutPromises);
17579
+ (_this$_popoutWindowSe14 = this._popoutWindowService) === null || _this$_popoutWindowSe14 === void 0 || _this$_popoutWindowSe14.finishRestoration(popoutPromises);
17092
17580
  (_this$_floatingGroupS5 = this._floatingGroupService) === null || _this$_floatingGroupS5 === void 0 || _this$_floatingGroupS5.constrainBounds();
17093
17581
  if (typeof activeGroup === "string") {
17094
17582
  const panel = this.getPanel(activeGroup);
@@ -17256,15 +17744,13 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17256
17744
  }
17257
17745
  }
17258
17746
  const group = grid ? members[0] : createGroup(data);
17259
- return popoutService.scheduleRestoration(index * 100, () => {
17260
- this.addPopoutGroup(group, {
17261
- position: position !== null && position !== void 0 ? position : void 0,
17262
- overridePopoutGroup: gridReferenceGroup ? group : void 0,
17263
- overridePopoutGridview,
17264
- referenceGroup: gridReferenceGroup ? this.getPanel(gridReferenceGroup) : void 0,
17265
- popoutUrl: url
17266
- });
17267
- }, () => {
17747
+ return popoutService.scheduleRestoration(index * 100, () => this.addPopoutGroup(group, {
17748
+ position: position !== null && position !== void 0 ? position : void 0,
17749
+ overridePopoutGroup: gridReferenceGroup ? group : void 0,
17750
+ overridePopoutGridview,
17751
+ referenceGroup: gridReferenceGroup ? this.getPanel(gridReferenceGroup) : void 0,
17752
+ popoutUrl: url
17753
+ }), () => {
17268
17754
  for (const orphan of members.length > 0 ? members : [group]) if (!this.isDisposed && this._groups.has(orphan.id) && orphan.element.parentElement === null) {
17269
17755
  for (const panel of [...orphan.panels]) this.removePanel(panel, { removeEmptyGroup: false });
17270
17756
  orphan.dispose();
@@ -17499,7 +17985,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17499
17985
  * window.
17500
17986
  */
17501
17987
  detachFromNestedWindow(group) {
17502
- var _this$_floatingGroupS7, _this$_popoutWindowSe13;
17988
+ var _this$_floatingGroupS7, _this$_popoutWindowSe15;
17503
17989
  const floating = (_this$_floatingGroupS7 = this._floatingGroupService) === null || _this$_floatingGroupS7 === void 0 ? void 0 : _this$_floatingGroupS7.findByGroup(group);
17504
17990
  if (floating) {
17505
17991
  const members = this.nestedWindowMembers(group);
@@ -17508,7 +17994,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17508
17994
  if (floating.group === group) floating.setAnchorGroup(members.find((m) => m !== group));
17509
17995
  return true;
17510
17996
  }
17511
- const popout = (_this$_popoutWindowSe13 = this._popoutWindowService) === null || _this$_popoutWindowSe13 === void 0 ? void 0 : _this$_popoutWindowSe13.findByGroup(group);
17997
+ const popout = (_this$_popoutWindowSe15 = this._popoutWindowService) === null || _this$_popoutWindowSe15 === void 0 ? void 0 : _this$_popoutWindowSe15.findByGroup(group);
17512
17998
  if (popout) {
17513
17999
  const members = this.nestedWindowMembers(group);
17514
18000
  if (members.length <= 1) return false;
@@ -17565,8 +18051,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17565
18051
  return group;
17566
18052
  }
17567
18053
  if (group.api.location.type === "popout") {
17568
- var _this$_popoutWindowSe14, _this$_popoutWindowSe15;
17569
- const selectedGroup = (_this$_popoutWindowSe14 = this._popoutWindowService) === null || _this$_popoutWindowSe14 === void 0 ? void 0 : _this$_popoutWindowSe14.findByGroup(group);
18054
+ var _this$_popoutWindowSe16, _this$_popoutWindowSe17;
18055
+ const selectedGroup = (_this$_popoutWindowSe16 = this._popoutWindowService) === null || _this$_popoutWindowSe16 === void 0 ? void 0 : _this$_popoutWindowSe16.findByGroup(group);
17570
18056
  if (!selectedGroup) throw new Error("dockview: failed to find popout group");
17571
18057
  if (this.detachFromNestedWindow(group)) {
17572
18058
  if (options === null || options === void 0 ? void 0 : options.skipDispose) group.model.location = { type: "grid" };
@@ -17583,7 +18069,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17583
18069
  this._groups.delete(group.id);
17584
18070
  this._onDidRemoveGroup.fire(group);
17585
18071
  }
17586
- (_this$_popoutWindowSe15 = this._popoutWindowService) === null || _this$_popoutWindowSe15 === void 0 || _this$_popoutWindowSe15.remove(selectedGroup);
18072
+ (_this$_popoutWindowSe17 = this._popoutWindowService) === null || _this$_popoutWindowSe17 === void 0 || _this$_popoutWindowSe17.remove(selectedGroup);
17587
18073
  const removedGroup = selectedGroup.disposable.dispose();
17588
18074
  if (!(options === null || options === void 0 ? void 0 : options.skipPopoutReturn) && removedGroup) {
17589
18075
  this.doAddGroup(removedGroup, [0]);
@@ -17610,10 +18096,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17610
18096
  debouncedUpdateAllPositions() {
17611
18097
  if (this._updatePositionsFrameId !== void 0) cancelAnimationFrame(this._updatePositionsFrameId);
17612
18098
  this._updatePositionsFrameId = requestAnimationFrame(() => {
17613
- var _this$_popoutWindowSe16, _this$_popoutWindowSe17;
18099
+ var _this$_popoutWindowSe18, _this$_popoutWindowSe19;
17614
18100
  this._updatePositionsFrameId = void 0;
17615
18101
  this.overlayRenderContainer.updateAllPositions();
17616
- for (const entry of (_this$_popoutWindowSe16 = (_this$_popoutWindowSe17 = this._popoutWindowService) === null || _this$_popoutWindowSe17 === void 0 ? void 0 : _this$_popoutWindowSe17.entries) !== null && _this$_popoutWindowSe16 !== void 0 ? _this$_popoutWindowSe16 : []) entry.overlayRenderContainer.updateAllPositions();
18102
+ for (const entry of (_this$_popoutWindowSe18 = (_this$_popoutWindowSe19 = this._popoutWindowService) === null || _this$_popoutWindowSe19 === void 0 ? void 0 : _this$_popoutWindowSe19.entries) !== null && _this$_popoutWindowSe18 !== void 0 ? _this$_popoutWindowSe18 : []) entry.overlayRenderContainer.updateAllPositions();
17617
18103
  });
17618
18104
  }
17619
18105
  movingLock(func) {
@@ -17863,7 +18349,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17863
18349
  }
17864
18350
  }
17865
18351
  if (sourceGroup.api.location.type === "popout" && this.nestedWindowMembers(sourceGroup).length <= 1) {
17866
- var _this$_popoutWindowSe18;
18352
+ var _this$_popoutWindowSe20;
17867
18353
  /**
17868
18354
  * the source group is the only group in a popout window and
17869
18355
  * has a single panel
@@ -17878,7 +18364,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17878
18364
  * Multi-group popout windows fall through to the generic
17879
18365
  * detach-and-re-add path so the window stays alive.
17880
18366
  */
17881
- const popoutGroup = (_this$_popoutWindowSe18 = this._popoutWindowService) === null || _this$_popoutWindowSe18 === void 0 ? void 0 : _this$_popoutWindowSe18.findByGroup(sourceGroup);
18367
+ const popoutGroup = (_this$_popoutWindowSe20 = this._popoutWindowService) === null || _this$_popoutWindowSe20 === void 0 ? void 0 : _this$_popoutWindowSe20.findByGroup(sourceGroup);
17882
18368
  if (!popoutGroup) return;
17883
18369
  const removedPanel = this.movingLock(() => popoutGroup.popoutGroup.model.removePanel(popoutGroup.popoutGroup.panels[0], {
17884
18370
  skipSetActive: true,
@@ -18087,11 +18573,11 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
18087
18573
  break;
18088
18574
  }
18089
18575
  case "popout": {
18090
- var _this$_popoutWindowSe19, _this$_popoutWindowSe20;
18091
- const selectedPopoutGroup = (_this$_popoutWindowSe19 = this._popoutWindowService) === null || _this$_popoutWindowSe19 === void 0 ? void 0 : _this$_popoutWindowSe19.findByGroup(from);
18576
+ var _this$_popoutWindowSe21, _this$_popoutWindowSe22;
18577
+ const selectedPopoutGroup = (_this$_popoutWindowSe21 = this._popoutWindowService) === null || _this$_popoutWindowSe21 === void 0 ? void 0 : _this$_popoutWindowSe21.findByGroup(from);
18092
18578
  if (!selectedPopoutGroup) throw new Error("dockview: failed to find popout group");
18093
18579
  if (this.detachFromNestedWindow(from)) break;
18094
- (_this$_popoutWindowSe20 = this._popoutWindowService) === null || _this$_popoutWindowSe20 === void 0 || _this$_popoutWindowSe20.remove(selectedPopoutGroup);
18580
+ (_this$_popoutWindowSe22 = this._popoutWindowService) === null || _this$_popoutWindowSe22 === void 0 || _this$_popoutWindowSe22.remove(selectedPopoutGroup);
18095
18581
  if (selectedPopoutGroup.referenceGroup) {
18096
18582
  const referenceGroup = this.getPanel(selectedPopoutGroup.referenceGroup);
18097
18583
  if (referenceGroup && !referenceGroup.api.isVisible) this.doRemoveGroup(referenceGroup, { skipActive: true });
@@ -18256,8 +18742,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
18256
18742
  * window-local containers).
18257
18743
  */
18258
18744
  setGroupLocationForRoot(group, gridview) {
18259
- var _this$_popoutWindowSe21;
18260
- const popout = (_this$_popoutWindowSe21 = this._popoutWindowService) === null || _this$_popoutWindowSe21 === void 0 ? void 0 : _this$_popoutWindowSe21.entries.find((entry) => entry.gridview === gridview);
18745
+ var _this$_popoutWindowSe23;
18746
+ const popout = (_this$_popoutWindowSe23 = this._popoutWindowService) === null || _this$_popoutWindowSe23 === void 0 ? void 0 : _this$_popoutWindowSe23.entries.find((entry) => entry.gridview === gridview);
18261
18747
  if (popout) {
18262
18748
  if (group.model.renderContainer !== popout.overlayRenderContainer) group.model.renderContainer = popout.overlayRenderContainer;
18263
18749
  group.model.dropTargetContainer = popout.dropTargetContainer;
@@ -18277,10 +18763,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
18277
18763
  * the nested gridview of the floating / popout window it lives in.
18278
18764
  */
18279
18765
  getGridviewForGroup(group) {
18280
- var _this$_floatingGroupS10, _this$_popoutWindowSe22;
18766
+ var _this$_floatingGroupS10, _this$_popoutWindowSe24;
18281
18767
  const floating = (_this$_floatingGroupS10 = this._floatingGroupService) === null || _this$_floatingGroupS10 === void 0 ? void 0 : _this$_floatingGroupS10.findByGroup(group);
18282
18768
  if (floating) return floating.gridview;
18283
- const popout = (_this$_popoutWindowSe22 = this._popoutWindowService) === null || _this$_popoutWindowSe22 === void 0 ? void 0 : _this$_popoutWindowSe22.findByGroup(group);
18769
+ const popout = (_this$_popoutWindowSe24 = this._popoutWindowService) === null || _this$_popoutWindowSe24 === void 0 ? void 0 : _this$_popoutWindowSe24.findByGroup(group);
18284
18770
  if (popout) return popout.gridview;
18285
18771
  return this.gridview;
18286
18772
  }
@@ -18302,13 +18788,13 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
18302
18788
  return location.length % 2 == 1 ? rootOrientation : orthogonal(rootOrientation);
18303
18789
  }
18304
18790
  updateTheme() {
18305
- var _this$_options$theme, _this$_shellThemeClas, _theme$gap, _this$_popoutWindowSe23, _this$_popoutWindowSe24, _this$_shellManager5, _theme$edgeGroupColla, _theme$tabGroupIndica;
18791
+ var _this$_options$theme, _this$_shellThemeClas, _theme$gap, _this$_popoutWindowSe25, _this$_popoutWindowSe26, _this$_shellManager5, _theme$edgeGroupColla, _theme$tabGroupIndica;
18306
18792
  const theme = (_this$_options$theme = this._options.theme) !== null && _this$_options$theme !== void 0 ? _this$_options$theme : themeAbyss;
18307
18793
  (_this$_shellThemeClas = this._shellThemeClassnames) === null || _this$_shellThemeClas === void 0 || _this$_shellThemeClas.setClassNames(theme.className);
18308
18794
  const gap = (_theme$gap = theme.gap) !== null && _theme$gap !== void 0 ? _theme$gap : 0;
18309
18795
  this.gridview.margin = gap;
18310
18796
  for (const floating of this.floatingGroups) floating.gridview.margin = gap;
18311
- for (const entry of (_this$_popoutWindowSe23 = (_this$_popoutWindowSe24 = this._popoutWindowService) === null || _this$_popoutWindowSe24 === void 0 ? void 0 : _this$_popoutWindowSe24.entries) !== null && _this$_popoutWindowSe23 !== void 0 ? _this$_popoutWindowSe23 : []) entry.gridview.margin = gap;
18797
+ for (const entry of (_this$_popoutWindowSe25 = (_this$_popoutWindowSe26 = this._popoutWindowService) === null || _this$_popoutWindowSe26 === void 0 ? void 0 : _this$_popoutWindowSe26.entries) !== null && _this$_popoutWindowSe25 !== void 0 ? _this$_popoutWindowSe25 : []) entry.gridview.margin = gap;
18312
18798
  (_this$_shellManager5 = this._shellManager) === null || _this$_shellManager5 === void 0 || _this$_shellManager5.updateTheme(gap, (_theme$edgeGroupColla = theme.edgeGroupCollapsedSize) !== null && _theme$edgeGroupColla !== void 0 ? _theme$edgeGroupColla : 35);
18313
18799
  if (theme.dndOverlayBorder === void 0) {
18314
18800
  var _this$_shellManager6;
@@ -18377,6 +18863,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
18377
18863
  }), this.onDidActiveChange((event) => {
18378
18864
  this._onDidActiveGroupChange.fire(event);
18379
18865
  }));
18866
+ this.layoutFromElement();
18380
18867
  }
18381
18868
  updateOptions(options) {
18382
18869
  super.updateOptions(options);
@@ -18622,6 +19109,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
18622
19109
  this._options = options;
18623
19110
  this.splitview = new Splitview(this.element, options);
18624
19111
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
19112
+ this.layoutFromElement();
18625
19113
  }
18626
19114
  updateOptions(options) {
18627
19115
  if ("className" in options) {
@@ -19303,11 +19791,13 @@ exports.createSplitview = createSplitview;
19303
19791
  exports.defineModule = defineModule;
19304
19792
  exports.directionToPosition = directionToPosition;
19305
19793
  exports.findRelativeZIndexParent = findRelativeZIndexParent;
19794
+ exports.getActiveElement = getActiveElement;
19306
19795
  exports.getDirectionOrientation = getDirectionOrientation;
19307
19796
  exports.getGridLocation = getGridLocation;
19308
19797
  exports.getLocationOrientation = getLocationOrientation;
19309
19798
  exports.getPaneData = getPaneData;
19310
19799
  exports.getPanelData = getPanelData;
19800
+ exports.getPopoutUrlError = getPopoutUrlError;
19311
19801
  exports.getRegisteredModules = getRegisteredModules;
19312
19802
  exports.getRelativeLocation = getRelativeLocation;
19313
19803
  exports.indexInParent = indexInParent;