dockview-core 8.3.1 → 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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 8.3.1
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,8 +4899,7 @@ 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) {
@@ -4500,7 +4949,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4500
4949
  this._onDragEnd.fire(dragEvent);
4501
4950
  }
4502
4951
  _teardown() {
4503
- 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;
4504
4953
  this._currentTarget = void 0;
4505
4954
  this._active = void 0;
4506
4955
  this._lastPointerEvent = void 0;
@@ -4510,6 +4959,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4510
4959
  this._ghost = void 0;
4511
4960
  (_this$_iframeShield = this._iframeShield) === null || _this$_iframeShield === void 0 || _this$_iframeShield.release();
4512
4961
  this._iframeShield = void 0;
4962
+ (_this$_selectionShiel = this._selectionShield) === null || _this$_selectionShiel === void 0 || _this$_selectionShiel.release();
4963
+ this._selectionShield = void 0;
4513
4964
  (_this$_moveListener = this._moveListener) === null || _this$_moveListener === void 0 || _this$_moveListener.dispose();
4514
4965
  (_this$_upListener = this._upListener) === null || _this$_upListener === void 0 || _this$_upListener.dispose();
4515
4966
  (_this$_cancelListener = this._cancelListener) === null || _this$_cancelListener === void 0 || _this$_cancelListener.dispose();
@@ -4778,9 +5229,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4778
5229
  return true;
4779
5230
  }
4780
5231
  _onPointerDown(event) {
4781
- 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;
4782
5233
  if (!this._shouldHandle(event)) return;
4783
5234
  this._cancelPending();
5235
+ this._selectionShield = disableTextSelection((_this$element$ownerDo = this.element.ownerDocument) !== null && _this$element$ownerDo !== void 0 ? _this$element$ownerDo : document);
4784
5236
  this._pendingPointerId = event.pointerId;
4785
5237
  this._startX = event.clientX;
4786
5238
  this._startY = event.clientY;
@@ -4796,7 +5248,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4796
5248
  const threshold = (_this$options$thresho = this.options.threshold) !== null && _this$options$thresho !== void 0 ? _this$options$thresho : DEFAULT_THRESHOLD;
4797
5249
  const pressToleranceOpt = this.options.pressTolerance;
4798
5250
  const pressTolerance = (_ref2 = typeof pressToleranceOpt === "function" ? pressToleranceOpt() : pressToleranceOpt) !== null && _ref2 !== void 0 ? _ref2 : DEFAULT_PRESS_TOLERANCE;
4799
- 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;
4800
5252
  this._pendingMoveListener = addDisposableListener(targetWindow, "pointermove", (moveEvent) => {
4801
5253
  if (moveEvent.pointerId !== this._pendingPointerId) return;
4802
5254
  const dx = moveEvent.clientX - this._startX;
@@ -4822,7 +5274,9 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4822
5274
  this._cancelPending();
4823
5275
  }
4824
5276
  _cancelPending() {
4825
- 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;
4826
5280
  this._pendingPointerId = void 0;
4827
5281
  if (this._armTimer !== void 0) {
4828
5282
  clearTimeout(this._armTimer);
@@ -4867,29 +5321,51 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4867
5321
  */
4868
5322
  var PointerGhost = class {
4869
5323
  constructor(opts) {
4870
- var _opts$offsetX, _opts$offsetY, _opts$opacity, _opts$owner$ownerDocu, _opts$owner;
5324
+ var _opts$offsetX, _opts$offsetY, _popover, _opts$opacity;
4871
5325
  this._disposed = false;
4872
5326
  this.element = opts.element;
4873
5327
  this.offsetX = (_opts$offsetX = opts.offsetX) !== null && _opts$offsetX !== void 0 ? _opts$offsetX : 0;
4874
5328
  this.offsetY = (_opts$offsetY = opts.offsetY) !== null && _opts$offsetY !== void 0 ? _opts$offsetY : 0;
4875
- this.element.style.position = "fixed";
4876
- this.element.style.left = "0px";
4877
- this.element.style.top = "0px";
4878
- this.element.style.pointerEvents = "none";
4879
- this.element.style.zIndex = "99999";
4880
- this.element.style.opacity = String((_opts$opacity = opts.opacity) !== null && _opts$opacity !== void 0 ? _opts$opacity : .8);
4881
- this.element.style.willChange = "transform";
4882
- this.element.style.transform = `translate3d(${opts.initialX - this.offsetX}px, ${opts.initialY - this.offsetY}px, 0)`;
4883
- ((_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();
4884
5359
  }
4885
5360
  update(clientX, clientY) {
4886
5361
  if (this._disposed) return;
4887
- 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)`;
4888
5363
  }
4889
5364
  dispose() {
4890
5365
  if (this._disposed) return;
4891
5366
  this._disposed = true;
4892
5367
  this.element.remove();
5368
+ if (this.container !== this.element) this.container.remove();
4893
5369
  }
4894
5370
  };
4895
5371
 
@@ -4926,7 +5402,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4926
5402
  addGhostImage(event.dataTransfer, ghost.element, {
4927
5403
  x: (_ghost$offsetX = ghost.offsetX) !== null && _ghost$offsetX !== void 0 ? _ghost$offsetX : 0,
4928
5404
  y: (_ghost$offsetY = ghost.offsetY) !== null && _ghost$offsetY !== void 0 ? _ghost$offsetY : 0,
4929
- 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
4930
5407
  });
4931
5408
  if (ghost.dispose) {
4932
5409
  const disposeGhost = ghost.dispose;
@@ -5762,8 +6239,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
5762
6239
  let guard;
5763
6240
  const timeout = setTimeout(() => guard === null || guard === void 0 ? void 0 : guard.dispose(), 500);
5764
6241
  guard = addDisposableListener(targetWindow, "click", (event) => {
5765
- const target = event.target;
5766
- if (target && this.element.contains(target)) {
6242
+ if (isEventWithin(event, [this.element])) {
5767
6243
  event.preventDefault();
5768
6244
  event.stopPropagation();
5769
6245
  }
@@ -5879,7 +6355,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
5879
6355
  if (this.accessor.id === (data === null || data === void 0 ? void 0 : data.viewId)) {
5880
6356
  var _this$accessor$option;
5881
6357
  if (((_this$accessor$option = this.accessor.options.theme) === null || _this$accessor$option === void 0 ? void 0 : _this$accessor$option.tabAnimation) === "smooth") return false;
5882
- if (data.tabGroupId && this.group.model.getTabGroupForPanel(this.panel.id)) return false;
6358
+ if (data.tabGroupId && data.groupId === this.group.id && this.group.model.getTabGroupForPanel(this.panel.id)) return false;
5883
6359
  return true;
5884
6360
  }
5885
6361
  return this.group.model.canDisplayOverlay(event, position, "tab");
@@ -6492,6 +6968,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
6492
6968
  const PROPERTY_KEYS_DOCKVIEW = (() => {
6493
6969
  return Object.keys({
6494
6970
  disableAutoResizing: void 0,
6971
+ proportionalLayout: void 0,
6495
6972
  hideBorders: void 0,
6496
6973
  singleTabMode: void 0,
6497
6974
  disableFloatingGroups: void 0,
@@ -7345,10 +7822,16 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7345
7822
  (_entry$pointerDropTar = entry.pointerDropTarget) === null || _entry$pointerDropTar === void 0 || _entry$pointerDropTar.clearOverlay();
7346
7823
  }
7347
7824
  }
7348
- snapshotChipWidths() {
7349
- const widths = /* @__PURE__ */ new Map();
7350
- for (const [groupId, entry] of this._chipRenderers) widths.set(groupId, entry.chip.element.getBoundingClientRect().width);
7351
- return widths;
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;
7352
7835
  }
7353
7836
  positionUnderlines() {
7354
7837
  var _this$_indicator2;
@@ -7740,6 +8223,22 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7740
8223
  //#endregion
7741
8224
  //#region src/dockview/components/titlebar/tabReorderController.ts
7742
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
+ /**
7743
8242
  * Tab drag-reorder + FLIP animation subsystem extracted from `Tabs`. The DOM
7744
8243
  * event wiring remains in `Tabs` and delegates the reorder/animation logic to
7745
8244
  * this controller. All access back into `Tabs` goes through
@@ -7834,14 +8333,30 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7834
8333
  for (const tab of this._tabs) positions.set(tab.value.panel.id, tab.value.element.getBoundingClientRect());
7835
8334
  return positions;
7836
8335
  }
7837
- 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() {
7838
8357
  if (this._tabs.length === 0) return 0;
7839
- const isVertical = this._direction === "vertical";
7840
8358
  let total = 0;
7841
- for (const tab of this._tabs) {
7842
- const rect = tab.value.element.getBoundingClientRect();
7843
- total += isVertical ? rect.height : rect.width;
7844
- }
8359
+ for (const tab of this._tabs) total += this._mainAxisSize(tab.value.element.getBoundingClientRect());
7845
8360
  return total / this._tabs.length;
7846
8361
  }
7847
8362
  /**
@@ -7851,8 +8366,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7851
8366
  * `processDragOver` / `processDragLeave` helpers.
7852
8367
  */
7853
8368
  handlePointerDragMove(clientX, clientY) {
7854
- var _this$_tabsList$owner;
7855
- 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);
7856
8370
  if (!(!!elAtPoint && (this._tabsList.contains(elAtPoint) || !!this._extendedDropZone && this._extendedDropZone.contains(elAtPoint)))) {
7857
8371
  if (this._pointerInsideTabsList) {
7858
8372
  this._pointerInsideTabsList = false;
@@ -7881,8 +8395,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7881
8395
  this.resetDragAnimation();
7882
8396
  }
7883
8397
  isPointInsideTabsList(clientX, clientY) {
7884
- var _this$_tabsList$owner2;
7885
- 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);
7886
8399
  return !!el && this._tabsList.contains(el);
7887
8400
  }
7888
8401
  /** Commit a smooth-mode intra-group reorder from the current insertion
@@ -7946,46 +8459,46 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
7946
8459
  const data = getPanelData();
7947
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;
7948
8461
  if (!data || !(data.panelId || data.tabGroupId) || data.groupId === this.group.id) return false;
7949
- const avgWidth = this.getAverageTabWidth();
7950
- 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);
7951
8464
  return true;
7952
8465
  }
7953
8466
  /** Anim state for an external group-chip drag (gap sized to the group). */
7954
- _makeGroupDragAnimState(data, avgWidth) {
8467
+ _makeGroupDragAnimState(data, avgSize) {
7955
8468
  var _sourceTg$panelIds$le;
7956
8469
  const sourceGroup = this.accessor.getPanel(data.groupId);
7957
8470
  const sourceTg = sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.getTabGroups().find((tg) => tg.id === data.tabGroupId);
7958
- 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;
7959
8472
  return {
7960
8473
  sourceTabId: "",
7961
8474
  sourceIndex: -1,
7962
8475
  tabPositions: this.snapshotTabPositions(),
7963
- chipPositions: this._tabGroupManager.snapshotChipWidths(),
8476
+ chipSizes: this._tabGroupManager.snapshotChipSizes(),
7964
8477
  currentInsertionIndex: null,
7965
8478
  targetTabGroupId: null,
7966
8479
  sourceTabGroupId: data.tabGroupId,
7967
8480
  sourceGroupPanelIds: sourceTg ? new Set(sourceTg.panelIds) : /* @__PURE__ */ new Set(),
7968
- sourceChipWidth: avgWidth,
7969
- cursorOffsetFromDragLeft: groupGapWidth / 2,
7970
- sourceGapWidth: groupGapWidth,
7971
- containerLeft: this._tabsList.getBoundingClientRect().left
8481
+ sourceChipSize: avgSize,
8482
+ cursorOffsetFromDragStart: groupGapSize / 2,
8483
+ sourceGapSize: groupGapSize,
8484
+ containerStart: this._mainAxisStart(this._tabsList.getBoundingClientRect())
7972
8485
  };
7973
8486
  }
7974
8487
  /** Anim state for an external single-tab drag. */
7975
- _makeTabDragAnimState(data, avgWidth) {
8488
+ _makeTabDragAnimState(data, avgSize) {
7976
8489
  return {
7977
8490
  sourceTabId: data.panelId,
7978
8491
  sourceIndex: -1,
7979
8492
  tabPositions: this.snapshotTabPositions(),
7980
- chipPositions: this._tabGroupManager.snapshotChipWidths(),
8493
+ chipSizes: this._tabGroupManager.snapshotChipSizes(),
7981
8494
  currentInsertionIndex: null,
7982
8495
  targetTabGroupId: null,
7983
8496
  sourceTabGroupId: null,
7984
8497
  sourceGroupPanelIds: null,
7985
- sourceChipWidth: 0,
7986
- cursorOffsetFromDragLeft: avgWidth / 2,
7987
- sourceGapWidth: avgWidth,
7988
- containerLeft: this._tabsList.getBoundingClientRect().left
8498
+ sourceChipSize: 0,
8499
+ cursorOffsetFromDragStart: avgSize / 2,
8500
+ sourceGapSize: avgSize,
8501
+ containerStart: this._mainAxisStart(this._tabsList.getBoundingClientRect())
7989
8502
  };
7990
8503
  }
7991
8504
  /**
@@ -8028,19 +8541,19 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8028
8541
  container === null || container === void 0 || (_container$model = container.model) === null || _container$model === void 0 || _container$model.clear();
8029
8542
  }
8030
8543
  handleDragOver(event) {
8031
- var _this$accessor$option2;
8544
+ var _event$clientY2, _this$accessor$option2;
8032
8545
  if (!this._animState) return;
8033
8546
  if (this._wrapMode && !this._animState.sourceTabGroupId) {
8034
8547
  var _event$clientY;
8035
8548
  this.handleWrappedDragOver(event.clientX, (_event$clientY = event.clientY) !== null && _event$clientY !== void 0 ? _event$clientY : 0);
8036
8549
  return;
8037
8550
  }
8038
- const mouseX = event.clientX;
8551
+ const mousePos = this._mainAxisCoord(event.clientX, (_event$clientY2 = event.clientY) !== null && _event$clientY2 !== void 0 ? _event$clientY2 : 0);
8039
8552
  const firstPanelToGroup = this._buildFirstPanelToGroupMap();
8040
- let insertionIndex = this._computeDragOverInsertionIndex(mouseX, firstPanelToGroup);
8553
+ let insertionIndex = this._computeDragOverInsertionIndex(mousePos, firstPanelToGroup);
8041
8554
  let targetTabGroupId = null;
8042
8555
  if (insertionIndex !== null && this._tabGroupManager.chipRenderers.size > 0) {
8043
- const resolved = this._resolveInsertionAgainstTabGroups(mouseX, insertionIndex, firstPanelToGroup);
8556
+ const resolved = this._resolveInsertionAgainstTabGroups(mousePos, insertionIndex, firstPanelToGroup);
8044
8557
  insertionIndex = resolved.insertionIndex;
8045
8558
  targetTabGroupId = resolved.targetTabGroupId;
8046
8559
  }
@@ -8064,14 +8577,15 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8064
8577
  return firstPanelToGroup;
8065
8578
  }
8066
8579
  /**
8067
- * Walk the tabs left-to-right by their original widths and return the
8068
- * 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).
8069
8583
  */
8070
- _computeDragOverInsertionIndex(mouseX, firstPanelToGroup) {
8584
+ _computeDragOverInsertionIndex(mousePos, firstPanelToGroup) {
8071
8585
  const animState = this._animState;
8072
8586
  const sourceGroupPanelIds = animState.sourceGroupPanelIds;
8073
- const availableSpace = mouseX - animState.cursorOffsetFromDragLeft - animState.containerLeft;
8074
- let accWidth = 0;
8587
+ const availableSpace = mousePos - animState.cursorOffsetFromDragStart - animState.containerStart;
8588
+ let accSize = 0;
8075
8589
  let insertionIndex = null;
8076
8590
  for (let i = 0; i < this._tabs.length; i++) {
8077
8591
  const tab = this._tabs[i].value;
@@ -8079,19 +8593,19 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8079
8593
  if (sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(tab.panel.id)) continue;
8080
8594
  const groupId = firstPanelToGroup.get(tab.panel.id);
8081
8595
  if (groupId) {
8082
- var _animState$chipPositi;
8083
- const chipWidth = (_animState$chipPositi = animState.chipPositions.get(groupId)) !== null && _animState$chipPositi !== void 0 ? _animState$chipPositi : 0;
8084
- 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) {
8085
8599
  var _insertionIndex;
8086
8600
  (_insertionIndex = insertionIndex) !== null && _insertionIndex !== void 0 || (insertionIndex = i);
8087
8601
  break;
8088
8602
  }
8089
- accWidth += chipWidth;
8603
+ accSize += chipSize;
8090
8604
  }
8091
8605
  const origRect = animState.tabPositions.get(tab.panel.id);
8092
- const tabWidth = origRect ? origRect.width : tab.element.getBoundingClientRect().width;
8093
- if (accWidth + tabWidth / 2 <= availableSpace) {
8094
- 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;
8095
8609
  insertionIndex = i + 1;
8096
8610
  } else {
8097
8611
  var _insertionIndex2;
@@ -8102,11 +8616,12 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8102
8616
  return insertionIndex;
8103
8617
  }
8104
8618
  /**
8105
- * Rebuild the accumulated original width up to `insertionIndex`, walking the
8106
- * tabs exactly the way the accumulation loop does, so callers know the
8107
- * 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.
8108
8623
  */
8109
- _accumulatedWidthUpTo(insertionIndex, firstPanelToGroup) {
8624
+ _accumulatedSizeUpTo(insertionIndex, firstPanelToGroup) {
8110
8625
  const animState = this._animState;
8111
8626
  const sourceGroupPanelIds = animState.sourceGroupPanelIds;
8112
8627
  let accUpTo = 0;
@@ -8117,11 +8632,11 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8117
8632
  if (i >= insertionIndex) break;
8118
8633
  const gid = firstPanelToGroup.get(tab.panel.id);
8119
8634
  if (gid) {
8120
- var _animState$chipPositi2;
8121
- 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;
8122
8637
  }
8123
8638
  const origRect = animState.tabPositions.get(tab.panel.id);
8124
- accUpTo += origRect ? origRect.width : tab.element.getBoundingClientRect().width;
8639
+ accUpTo += this._mainAxisSize(origRect !== null && origRect !== void 0 ? origRect : tab.element.getBoundingClientRect());
8125
8640
  }
8126
8641
  return accUpTo;
8127
8642
  }
@@ -8129,11 +8644,11 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8129
8644
  * Given a raw insertion index, snap it out of / into any tab group it falls
8130
8645
  * within and resolve the target group (if the drop should merge into one).
8131
8646
  */
8132
- _resolveInsertionAgainstTabGroups(mouseX, insertionIndex, firstPanelToGroup) {
8647
+ _resolveInsertionAgainstTabGroups(mousePos, insertionIndex, firstPanelToGroup) {
8133
8648
  const isGroupDrag = !!this._animState.sourceTabGroupId;
8134
- const accUpTo = this._accumulatedWidthUpTo(insertionIndex, firstPanelToGroup);
8649
+ const accUpTo = this._accumulatedSizeUpTo(insertionIndex, firstPanelToGroup);
8135
8650
  for (const tg of this.group.model.getTabGroups()) {
8136
- const resolved = this._evaluateTabGroupForInsertion(tg, mouseX, insertionIndex, accUpTo, isGroupDrag);
8651
+ const resolved = this._evaluateTabGroupForInsertion(tg, mousePos, insertionIndex, accUpTo, isGroupDrag);
8137
8652
  if (resolved) return resolved;
8138
8653
  }
8139
8654
  return {
@@ -8147,7 +8662,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8147
8662
  * group governs the slot (the caller stops iterating), or `null` when the
8148
8663
  * group is irrelevant and the caller should keep looking.
8149
8664
  */
8150
- _evaluateTabGroupForInsertion(tg, mouseX, insertionIndex, accUpTo, isGroupDrag) {
8665
+ _evaluateTabGroupForInsertion(tg, mousePos, insertionIndex, accUpTo, isGroupDrag) {
8151
8666
  const range = this._resolveGroupRange(tg);
8152
8667
  if (!range) return null;
8153
8668
  const { firstIdx, lastIdx } = range;
@@ -8155,7 +8670,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8155
8670
  const isJustBeforeGroup = !isInsideRange && insertionIndex === firstIdx - 1;
8156
8671
  if (!isInsideRange && !isJustBeforeGroup) return null;
8157
8672
  if (isGroupDrag) return this._resolveGroupDragTarget(insertionIndex, firstIdx, lastIdx, isInsideRange);
8158
- return this._resolveTabDragTarget(tg, mouseX, insertionIndex, accUpTo, firstIdx, isJustBeforeGroup);
8673
+ return this._resolveTabDragTarget(tg, mousePos, insertionIndex, accUpTo, firstIdx, isJustBeforeGroup);
8159
8674
  }
8160
8675
  /**
8161
8676
  * The index range this group occupies in the live tab list, excluding the
@@ -8190,13 +8705,13 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8190
8705
  }
8191
8706
  /** Insertion target for a single-tab drag against a group: decide whether
8192
8707
  * the drop merges into the group based on the cursor vs the chip edge. */
8193
- _resolveTabDragTarget(tg, mouseX, insertionIndex, accUpTo, firstIdx, isJustBeforeGroup) {
8194
- var _animState$chipPositi3;
8708
+ _resolveTabDragTarget(tg, mousePos, insertionIndex, accUpTo, firstIdx, isJustBeforeGroup) {
8709
+ var _animState$chipSizes$3;
8195
8710
  const animState = this._animState;
8196
- 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;
8197
8712
  if (isJustBeforeGroup) {
8198
8713
  if (!this._onlySourceBetween(insertionIndex, firstIdx)) return null;
8199
- 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 {
8200
8715
  insertionIndex: firstIdx,
8201
8716
  targetTabGroupId: tg.id
8202
8717
  };
@@ -8205,10 +8720,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8205
8720
  targetTabGroupId: null
8206
8721
  };
8207
8722
  }
8208
- const chipOriginalRight = animState.containerLeft + accUpTo + chipWidth;
8723
+ const chipOriginalEnd = animState.containerStart + accUpTo + chipSize;
8209
8724
  if (insertionIndex === firstIdx) return {
8210
8725
  insertionIndex,
8211
- targetTabGroupId: mouseX >= chipOriginalRight ? tg.id : null
8726
+ targetTabGroupId: mousePos >= chipOriginalEnd ? tg.id : null
8212
8727
  };
8213
8728
  return {
8214
8729
  insertionIndex,
@@ -8371,17 +8886,17 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8371
8886
  }
8372
8887
  if (this._pendingCollapse) return;
8373
8888
  const insertionIndex = this._animState.currentInsertionIndex;
8374
- const gapWidth = this._computeGapWidth();
8889
+ const gapSize = this._computeGapSize();
8375
8890
  const chipToShift = this._computeChipToShift(insertionIndex);
8376
- this._applyGapMargins(insertionIndex, gapWidth, chipToShift, skipTransition);
8891
+ this._applyGapMargins(insertionIndex, gapSize, chipToShift, skipTransition);
8377
8892
  }
8378
- /** Gap width for the current drag: the whole group's span for a group
8379
- * drag, otherwise the source tab's own width. */
8380
- _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() {
8381
8896
  const animState = this._animState;
8382
- if (animState.sourceTabGroupId && animState.sourceGroupPanelIds) return animState.sourceGapWidth;
8897
+ if (animState.sourceTabGroupId && animState.sourceGroupPanelIds) return animState.sourceGapSize;
8383
8898
  const sourceRect = animState.tabPositions.get(animState.sourceTabId);
8384
- return sourceRect ? sourceRect.width : this.getAverageTabWidth();
8899
+ return sourceRect ? this._mainAxisSize(sourceRect) : this.getAverageTabSize();
8385
8900
  }
8386
8901
  /**
8387
8902
  * When the insertion lands at or before a group's first tab, the chip is
@@ -8425,7 +8940,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8425
8940
  }
8426
8941
  /** Reset non-source chip margins, then apply the gap margin to the chip or
8427
8942
  * the first tab at/after the insertion index. */
8428
- _applyGapMargins(insertionIndex, gapWidth, chipToShift, skipTransition) {
8943
+ _applyGapMargins(insertionIndex, gapSize, chipToShift, skipTransition) {
8429
8944
  const animState = this._animState;
8430
8945
  const sourceGroupPanelIds = animState.sourceGroupPanelIds;
8431
8946
  let gapApplied = false;
@@ -8434,7 +8949,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8434
8949
  this._clearMargin(entry.chip.element, skipTransition);
8435
8950
  }
8436
8951
  if (chipToShift) {
8437
- this._setMargin(chipToShift, `${gapWidth}px`, skipTransition);
8952
+ this._setMargin(chipToShift, `${gapSize}px`, skipTransition);
8438
8953
  gapApplied = true;
8439
8954
  }
8440
8955
  for (let i = 0; i < this._tabs.length; i++) {
@@ -8442,7 +8957,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8442
8957
  if (tab.panel.id === animState.sourceTabId) continue;
8443
8958
  if (sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(tab.panel.id)) continue;
8444
8959
  if (!gapApplied && i >= insertionIndex) {
8445
- this._setMargin(tab.element, `${gapWidth}px`, skipTransition);
8960
+ this._setMargin(tab.element, `${gapSize}px`, skipTransition);
8446
8961
  gapApplied = true;
8447
8962
  } else this._clearMargin(tab.element, skipTransition);
8448
8963
  }
@@ -8452,31 +8967,33 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8452
8967
  _shiftingClass(el) {
8453
8968
  return el.classList.contains("dv-tab-group-chip") ? "dv-tab-group-chip--shifting" : "dv-tab--shifting";
8454
8969
  }
8455
- /** Apply a margin-left value to an element, optionally bypassing CSS
8970
+ /** Apply the main-axis gap margin to an element, optionally bypassing CSS
8456
8971
  * transitions for instant positioning. */
8457
8972
  _setMargin(el, value, skipTransition) {
8973
+ const property = this._gapMarginProperty;
8458
8974
  if (skipTransition) {
8459
8975
  el.style.transition = "none";
8460
- el.style.marginLeft = value;
8976
+ el.style.setProperty(property, value);
8461
8977
  el.getBoundingClientRect();
8462
8978
  el.style.removeProperty("transition");
8463
- } else el.style.marginLeft = value;
8979
+ } else el.style.setProperty(property, value);
8464
8980
  toggleClass(el, this._shiftingClass(el), true);
8465
8981
  }
8466
8982
  /** Clear an element's gap margin, animating it back to zero unless
8467
8983
  * transitions are skipped. */
8468
8984
  _clearMargin(el, skipTransition) {
8469
8985
  const cls = this._shiftingClass(el);
8986
+ const property = this._gapMarginProperty;
8470
8987
  const prev = this._pendingMarginCleanups.get(el);
8471
8988
  if (prev) prev();
8472
- if (skipTransition || !el.style.marginLeft) {
8473
- el.style.removeProperty("margin-left");
8989
+ if (skipTransition || !el.style.getPropertyValue(property)) {
8990
+ el.style.removeProperty(property);
8474
8991
  toggleClass(el, cls, false);
8475
8992
  } else {
8476
- el.style.marginLeft = "0px";
8993
+ el.style.setProperty(property, "0px");
8477
8994
  toggleClass(el, cls, true);
8478
8995
  const onEnd = () => {
8479
- el.style.removeProperty("margin-left");
8996
+ el.style.removeProperty(property);
8480
8997
  toggleClass(el, cls, false);
8481
8998
  el.removeEventListener("transitionend", onEnd);
8482
8999
  clearTimeout(fallbackTimer);
@@ -8501,6 +9018,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8501
9018
  }
8502
9019
  for (const [, entry] of this._tabGroupManager.chipRenderers) {
8503
9020
  entry.chip.element.style.removeProperty("margin-left");
9021
+ entry.chip.element.style.removeProperty("margin-top");
8504
9022
  toggleClass(entry.chip.element, "dv-tab-group-chip--shifting", false);
8505
9023
  }
8506
9024
  this._tabGroupManager.positionUnderlines();
@@ -9095,21 +9613,21 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
9095
9613
  panel
9096
9614
  });
9097
9615
  if (((_this$accessor$option2 = this.accessor.options.theme) === null || _this$accessor$option2 === void 0 ? void 0 : _this$accessor$option2.tabAnimation) === "smooth") {
9098
- const tabWidth = tab.element.getBoundingClientRect().width;
9616
+ const tabSize = mainAxisSize(tab.element.getBoundingClientRect(), this._direction);
9099
9617
  const sourceIndex = this._tabs.findIndex((x) => x.value === tab);
9100
9618
  this._animState = {
9101
9619
  sourceTabId: panel.id,
9102
9620
  sourceIndex,
9103
9621
  tabPositions: this.snapshotTabPositions(),
9104
- chipPositions: this._tabGroupManager.snapshotChipWidths(),
9622
+ chipSizes: this._tabGroupManager.snapshotChipSizes(),
9105
9623
  currentInsertionIndex: null,
9106
9624
  targetTabGroupId: null,
9107
9625
  sourceTabGroupId: null,
9108
9626
  sourceGroupPanelIds: null,
9109
- sourceChipWidth: 0,
9110
- cursorOffsetFromDragLeft: tabWidth / 2,
9111
- sourceGapWidth: tabWidth,
9112
- containerLeft: this._tabsList.getBoundingClientRect().left
9627
+ sourceChipSize: 0,
9628
+ cursorOffsetFromDragStart: tabSize / 2,
9629
+ sourceGapSize: tabSize,
9630
+ containerStart: mainAxisStart(this._tabsList.getBoundingClientRect(), this._direction)
9113
9631
  };
9114
9632
  this._pendingCollapse = true;
9115
9633
  requestAnimationFrame(() => {
@@ -9205,7 +9723,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
9205
9723
  this._tabGroupManager.positionAllChips();
9206
9724
  if (this._animState) {
9207
9725
  this._animState.tabPositions = this.snapshotTabPositions();
9208
- this._animState.chipPositions = this._tabGroupManager.snapshotChipWidths();
9726
+ this._animState.chipSizes = this._tabGroupManager.snapshotChipSizes();
9209
9727
  this.applyDragOverTransforms();
9210
9728
  }
9211
9729
  }
@@ -9227,7 +9745,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
9227
9745
  }
9228
9746
  if (this._animState) {
9229
9747
  this._animState.tabPositions = this.snapshotTabPositions();
9230
- this._animState.chipPositions = this._tabGroupManager.snapshotChipWidths();
9748
+ this._animState.chipSizes = this._tabGroupManager.snapshotChipSizes();
9231
9749
  this.applyDragOverTransforms();
9232
9750
  }
9233
9751
  }
@@ -9305,24 +9823,24 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
9305
9823
  const firstPanelId = tabGroup.panelIds[0];
9306
9824
  const firstIdx = firstPanelId ? this._tabs.findIndex((t) => t.value.panel.id === firstPanelId) : -1;
9307
9825
  const chipRect = chip.element.getBoundingClientRect();
9308
- let groupGapWidth = chipRect.width;
9826
+ let groupGapSize = mainAxisSize(chipRect, this._direction);
9309
9827
  for (const pid of tabGroup.panelIds) {
9310
9828
  const tabEntry = this._tabMap.get(pid);
9311
- if (tabEntry) groupGapWidth += tabEntry.value.element.getBoundingClientRect().width;
9829
+ if (tabEntry) groupGapSize += mainAxisSize(tabEntry.value.element.getBoundingClientRect(), this._direction);
9312
9830
  }
9313
9831
  this._animState = {
9314
9832
  sourceTabId: "",
9315
9833
  sourceIndex: firstIdx,
9316
9834
  tabPositions: this.snapshotTabPositions(),
9317
- chipPositions: this._tabGroupManager.snapshotChipWidths(),
9835
+ chipSizes: this._tabGroupManager.snapshotChipSizes(),
9318
9836
  currentInsertionIndex: null,
9319
9837
  targetTabGroupId: null,
9320
9838
  sourceTabGroupId: tabGroup.id,
9321
9839
  sourceGroupPanelIds: new Set(tabGroup.panelIds),
9322
- sourceChipWidth: chipRect.width,
9323
- cursorOffsetFromDragLeft: event.clientX - chipRect.left,
9324
- sourceGapWidth: groupGapWidth,
9325
- 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)
9326
9844
  };
9327
9845
  if (((_this$accessor$option4 = this.accessor.options.theme) === null || _this$accessor$option4 === void 0 ? void 0 : _this$accessor$option4.tabAnimation) !== "smooth") return;
9328
9846
  const groupPanelIds = new Set(tabGroup.panelIds);
@@ -10080,8 +10598,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
10080
10598
  return this.tabsContainer.getPanelForTab(element);
10081
10599
  }
10082
10600
  get isContentFocused() {
10083
- if (!document.activeElement) return false;
10084
- 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);
10085
10605
  }
10086
10606
  get headerPosition() {
10087
10607
  var _this$_headerPosition;
@@ -12992,6 +13512,12 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
12992
13512
  observer.observe(gridview.element);
12993
13513
  return { dispose: () => observer.disconnect() };
12994
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
+ */
12995
13521
  scheduleRestoration(delayMs, work, onCancel) {
12996
13522
  return new Promise((resolve) => {
12997
13523
  const cleanup = () => {
@@ -13006,8 +13532,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
13006
13532
  resolve();
13007
13533
  return;
13008
13534
  }
13009
- work();
13010
- resolve();
13535
+ Promise.resolve(work()).then(() => resolve(), () => resolve());
13011
13536
  }, delayMs);
13012
13537
  this._restorationCleanups.add(cleanup);
13013
13538
  });
@@ -14265,188 +14790,6 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
14265
14790
  }
14266
14791
  };
14267
14792
 
14268
- //#endregion
14269
- //#region \0@oxc-project+runtime@0.139.0/helpers/esm/asyncToGenerator.js
14270
- function asyncGeneratorStep(n, t, e, r, o, a, c) {
14271
- try {
14272
- var i = n[a](c), u = i.value;
14273
- } catch (n) {
14274
- e(n);
14275
- return;
14276
- }
14277
- i.done ? t(u) : Promise.resolve(u).then(r, o);
14278
- }
14279
- function _asyncToGenerator(n) {
14280
- return function() {
14281
- var t = this, e = arguments;
14282
- return new Promise(function(r, o) {
14283
- var a = n.apply(t, e);
14284
- function _next(n) {
14285
- asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
14286
- }
14287
- function _throw(n) {
14288
- asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
14289
- }
14290
- _next(void 0);
14291
- });
14292
- };
14293
- }
14294
-
14295
- //#endregion
14296
- //#region src/popoutWindow.ts
14297
- /**
14298
- * Reject popout URLs that aren't same-origin http(s). Blocks `javascript:`,
14299
- * `data:`, `blob:`, `vbscript:`, and cross-origin URLs that would otherwise
14300
- * execute in a context the browser still associates with the opener via
14301
- * `window.opener`.
14302
- */
14303
- function assertSameOriginPopoutUrl(url) {
14304
- let resolved;
14305
- try {
14306
- resolved = new URL(url, globalThis.location.href);
14307
- } catch (_unused) {
14308
- throw new Error(`dockview: invalid popout URL: ${url}`);
14309
- }
14310
- 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}`);
14311
- }
14312
- var PopoutWindow = class extends CompositeDisposable {
14313
- get window() {
14314
- var _this$_window$value, _this$_window;
14315
- 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;
14316
- }
14317
- constructor(target, className, options) {
14318
- super();
14319
- this.target = target;
14320
- this.className = className;
14321
- this.options = options;
14322
- this._onWillClose = new Emitter();
14323
- this.onWillClose = this._onWillClose.event;
14324
- this._onDidClose = new Emitter();
14325
- this.onDidClose = this._onDidClose.event;
14326
- this._window = null;
14327
- this.addDisposables(this._onWillClose, this._onDidClose, { dispose: () => {
14328
- this.close();
14329
- } });
14330
- }
14331
- dimensions() {
14332
- if (!this._window) return null;
14333
- const left = this._window.value.screenX;
14334
- return {
14335
- top: this._window.value.screenY,
14336
- left,
14337
- width: this._window.value.innerWidth,
14338
- height: this._window.value.innerHeight
14339
- };
14340
- }
14341
- close() {
14342
- if (this._window) {
14343
- var _this$options$onWillC, _this$options;
14344
- this._onWillClose.fire();
14345
- (_this$options$onWillC = (_this$options = this.options).onWillClose) === null || _this$options$onWillC === void 0 || _this$options$onWillC.call(_this$options, {
14346
- id: this.target,
14347
- window: this._window.value
14348
- });
14349
- this._window.disposable.dispose();
14350
- this._window = null;
14351
- this._onDidClose.fire();
14352
- }
14353
- }
14354
- open() {
14355
- var _this = this;
14356
- return _asyncToGenerator(function* () {
14357
- var _this$options$onDidOp, _this$options2;
14358
- if (_this._window) throw new Error("instance of popout window is already open");
14359
- const url = `${_this.options.url}`;
14360
- assertSameOriginPopoutUrl(url);
14361
- const features = Object.entries({
14362
- top: _this.options.top,
14363
- left: _this.options.left,
14364
- width: _this.options.width,
14365
- height: _this.options.height
14366
- }).map(([key, value]) => `${key}=${value}`).join(",");
14367
- /**
14368
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open
14369
- */
14370
- const externalWindow = window.open(url, _this.target, features);
14371
- if (!externalWindow)
14372
- /**
14373
- * Popup blocked
14374
- */
14375
- return null;
14376
- const disposable = new CompositeDisposable();
14377
- _this._window = {
14378
- value: externalWindow,
14379
- disposable
14380
- };
14381
- disposable.addDisposables(Disposable.from(() => {
14382
- externalWindow.close();
14383
- }), addDisposableListener(globalThis.window, "beforeunload", () => {
14384
- /**
14385
- * before the main window closes we should close this popup too
14386
- * to be good citizens
14387
- *
14388
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
14389
- */
14390
- _this.close();
14391
- }));
14392
- const container = _this.createPopoutWindowContainer();
14393
- if (_this.className) container.classList.add(_this.className);
14394
- (_this$options$onDidOp = (_this$options2 = _this.options).onDidOpen) === null || _this$options$onDidOp === void 0 || _this$options$onDidOp.call(_this$options2, {
14395
- id: _this.target,
14396
- window: externalWindow
14397
- });
14398
- return new Promise((resolve, reject) => {
14399
- externalWindow.addEventListener("unload", () => {});
14400
- /**
14401
- * `load` is the only event that resolves this promise with a
14402
- * container, so a window that goes away first would leave the
14403
- * caller awaiting a promise that never settles - and
14404
- * `addPopoutGroup` holds its layout transaction open until it does.
14405
- * Settle with `null` on close, the same signal a blocked popup
14406
- * gives and one the caller already handles. `resolve` after the
14407
- * fact is a no-op, so a `load` that arrived first still wins.
14408
- */
14409
- disposable.addDisposables(_this.onWillClose(() => resolve(null)));
14410
- externalWindow.addEventListener("load", () => {
14411
- /**
14412
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
14413
- */
14414
- try {
14415
- const externalDocument = externalWindow.document;
14416
- externalDocument.title = document.title;
14417
- externalDocument.body.appendChild(container);
14418
- addStyles(externalDocument, globalThis.document.styleSheets, { nonce: _this.options.nonce });
14419
- /**
14420
- * beforeunload must be registered after load for reasons I could not determine
14421
- * otherwise the beforeunload event will not fire when the window is closed
14422
- */
14423
- addDisposableListener(externalWindow, "beforeunload", () => {
14424
- /**
14425
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
14426
- */
14427
- _this.close();
14428
- });
14429
- resolve(container);
14430
- } catch (err) {
14431
- reject(err);
14432
- }
14433
- });
14434
- });
14435
- })();
14436
- }
14437
- createPopoutWindowContainer() {
14438
- const el = document.createElement("div");
14439
- el.classList.add("dv-popout-window");
14440
- el.id = "dv-popout-window";
14441
- el.style.position = "absolute";
14442
- el.style.width = "100%";
14443
- el.style.height = "100%";
14444
- el.style.top = "0px";
14445
- el.style.left = "0px";
14446
- return el;
14447
- }
14448
- };
14449
-
14450
14793
  //#endregion
14451
14794
  //#region src/dockview/strictEventsSequencing.ts
14452
14795
  var StrictEventsSequencing = class extends CompositeDisposable {
@@ -14490,8 +14833,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
14490
14833
  * peeks): while it lives it watches a configurable set of dismiss signals
14491
14834
  * (Escape / extra keys, outside-pointerdown with an optional grace window,
14492
14835
  * window resize, focus moving outside) and calls `onDismiss`. Inside/outside is
14493
- * decided by an `isInside` predicate (geometry) or a `contains` check against
14494
- * `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.
14495
14838
  *
14496
14839
  * It owns only the *signals*, not the surface element, its position, or any
14497
14840
  * hover/keep-open policy, so callers keep their own element lifecycle and
@@ -14511,9 +14854,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
14511
14854
  const isInside = (event) => {
14512
14855
  var _options$elements, _options$elements2;
14513
14856
  if (options.isInside) return options.isInside(event);
14514
- const target = event.target;
14515
- if (!(target instanceof Node)) return false;
14516
- 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 : []);
14517
14858
  };
14518
14859
  if (escape || keys.length > 0) disposables.addDisposables(addDisposableListener(win, "keydown", (event) => {
14519
14860
  if (escape && event.key === "Escape" || keys.includes(event.key)) options.onDismiss();
@@ -14532,17 +14873,45 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
14532
14873
  options.onDismiss();
14533
14874
  }));
14534
14875
  if (options.focusOut) {
14535
- const isFocusInside = (focused) => {
14536
- var _options$elements3, _options$elements4;
14537
- if (options.isFocusInside) return options.isFocusInside(focused);
14538
- 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];
14539
14881
  };
14882
+ const seen = /* @__PURE__ */ new WeakSet();
14540
14883
  const onFocusIn = (event) => {
14884
+ var _options$elements4, _options$elements5;
14885
+ if (seen.has(event)) return;
14886
+ seen.add(event);
14541
14887
  const target = event.target;
14542
- 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();
14543
14890
  };
14544
- win.addEventListener("focusin", onFocusIn, capture);
14545
- 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();
14546
14915
  }
14547
14916
  return disposables;
14548
14917
  }
@@ -15035,6 +15404,24 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
15035
15404
  this.updateTheme(this._gap, this._defaultCollapsedSize);
15036
15405
  return view;
15037
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
+ }
15038
15425
  layout(width, height) {
15039
15426
  this._outerSplitview.layout(width, height);
15040
15427
  this._flushPendingSizes();
@@ -15294,6 +15681,15 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
15294
15681
 
15295
15682
  //#endregion
15296
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
+ }
15297
15693
  function buildTabGroupColorPalette(options) {
15298
15694
  var _options$tabGroupColo;
15299
15695
  return new TabGroupColorPalette((_options$tabGroupColo = options.tabGroupColors) !== null && _options$tabGroupColo !== void 0 ? _options$tabGroupColo : DEFAULT_TAB_GROUP_COLORS, options.tabGroupAccent !== "off");
@@ -15345,6 +15741,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
15345
15741
  get panels() {
15346
15742
  return this.groups.flatMap((group) => group.panels);
15347
15743
  }
15744
+ /** `dndStrategy` resolved against this device; see `DockviewApi`. */
15745
+ get dndCapabilities() {
15746
+ return resolveDndCapabilities(this.options);
15747
+ }
15348
15748
  get options() {
15349
15749
  return this._options;
15350
15750
  }
@@ -15854,9 +16254,9 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
15854
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();
15855
16255
  }
15856
16256
  constructor(container, options) {
15857
- 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;
15858
16258
  super(container, {
15859
- proportionalLayout: true,
16259
+ proportionalLayout: (_options$proportional = options.proportionalLayout) !== null && _options$proportional !== void 0 ? _options$proportional : true,
15860
16260
  orientation: "HORIZONTAL",
15861
16261
  styles: options.hideBorders ? { separatorBorder: "transparent" } : void 0,
15862
16262
  disableAutoResizing: options.disableAutoResizing,
@@ -15903,6 +16303,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
15903
16303
  this.onDidChangePopouts = this._onDidChangePopouts.event;
15904
16304
  this._onDidOpenPopoutWindowFail = new Emitter();
15905
16305
  this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
16306
+ this._onWillClosePopoutWindow = new Emitter();
16307
+ this.onWillClosePopoutWindow = this._onWillClosePopoutWindow.event;
15906
16308
  this._onDidStartFloatingGroupDrag = new Emitter();
15907
16309
  this.onDidStartFloatingGroupDrag = this._onDidStartFloatingGroupDrag.event;
15908
16310
  this._onDidEndFloatingGroupDrag = new Emitter();
@@ -16004,7 +16406,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16004
16406
  var _this$_shellManager2;
16005
16407
  this._moduleRegistry.dispose();
16006
16408
  (_this$_shellManager2 = this._shellManager) === null || _this$_shellManager2 === void 0 || _this$_shellManager2.dispose();
16007
- }));
16409
+ }), this._onWillClosePopoutWindow);
16008
16410
  const rootDropTarget = this._rootDropTargetService;
16009
16411
  if (rootDropTarget) this.addDisposables(rootDropTarget.onWillShowOverlay((event) => {
16010
16412
  if (this.gridview.length > 0 && event.position === "center") return;
@@ -16017,6 +16419,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16017
16419
  }));
16018
16420
  }), rootDropTarget.onDrop((event) => this.dockToLayoutEdge(event.nativeEvent, event.position)));
16019
16421
  this._moduleRegistry.postConstruct(this);
16422
+ this._shellManager.layoutFromElement();
16020
16423
  }
16021
16424
  setVisible(panel, visible) {
16022
16425
  switch (panel.api.location.type) {
@@ -16086,22 +16489,36 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16086
16489
  const box = getBox();
16087
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();
16088
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";
16089
16493
  const _window = new PopoutWindow(`${this.id}-${groupId}`, theme !== null && theme !== void 0 ? theme : "", {
16090
- url: resolvedPopoutUrl !== null && resolvedPopoutUrl !== void 0 ? resolvedPopoutUrl : "/popout.html",
16494
+ url: popoutUrl,
16091
16495
  left: box.left,
16092
16496
  top: box.top,
16093
16497
  width: box.width,
16094
16498
  height: box.height,
16095
16499
  onDidOpen: options === null || options === void 0 ? void 0 : options.onDidOpen,
16096
- onWillClose: options === null || options === void 0 ? void 0 : options.onWillClose,
16097
- 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()
16098
16507
  });
16099
16508
  const popoutWindowDisposable = new CompositeDisposable(_window, _window.onDidClose(() => {
16100
16509
  popoutWindowDisposable.dispose();
16101
16510
  }));
16102
- return _window.open().then((popoutContainer) => {
16511
+ const openError = getPopoutUrlError(popoutUrl);
16512
+ return (openError ? Promise.resolve(null) : _window.open()).then((popoutContainer) => {
16103
16513
  var _options$referenceGro, _options$overridePopo4;
16104
- 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
+ }
16105
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;
16106
16523
  const referenceLocation = itemToPopout.api.location.type;
16107
16524
  /**
@@ -16120,11 +16537,16 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16120
16537
  if (popoutContainer) this._onDidAddGroup.fire(group);
16121
16538
  }
16122
16539
  if (popoutContainer === null) {
16540
+ var _window$failure;
16123
16541
  this.handleBlockedPopout({
16124
16542
  group,
16125
16543
  referenceGroup,
16126
16544
  options,
16127
- 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" }
16128
16550
  });
16129
16551
  return false;
16130
16552
  }
@@ -16287,16 +16709,17 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16287
16709
  });
16288
16710
  }
16289
16711
  /**
16290
- * The popout window was blocked (e.g. by the browser's popup blocker,
16291
- * common when restoring popouts on load). Fall back gracefully so the
16292
- * group(s) end up valid and visible in the main grid rather than as
16293
- * 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().
16294
16717
  */
16295
16718
  handleBlockedPopout(params) {
16296
- const { group, referenceGroup, options, popoutWindowDisposable } = params;
16297
- 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);
16298
16721
  popoutWindowDisposable.dispose();
16299
- this._onDidOpenPopoutWindowFail.fire();
16722
+ this._onDidOpenPopoutWindowFail.fire(failure);
16300
16723
  if (options === null || options === void 0 ? void 0 : options.overridePopoutGridview) {
16301
16724
  const blockedGridview = options.overridePopoutGridview;
16302
16725
  const members = this.groups.filter((candidate) => blockedGridview.element.contains(candidate.element));
@@ -16530,12 +16953,13 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16530
16953
  if (group.model.size === 0) this.doRemoveGroup(group, { skipActive: true });
16531
16954
  }
16532
16955
  /**
16533
- * Build an empty gridview configured to match the main grid's styling, for
16534
- * 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.
16535
16959
  */
16536
16960
  createNestedGridview(orientation = "HORIZONTAL") {
16537
16961
  var _this$options$theme$g, _this$options$theme2;
16538
- 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);
16539
16963
  }
16540
16964
  /**
16541
16965
  * Wrap a (populated) floating gridview in an overlay window: title bar /
@@ -16608,6 +17032,12 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16608
17032
  const newDisableDnd = this.options.disableDnd;
16609
17033
  const newDndStrategy = this.options.dndStrategy;
16610
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
+ }
16611
17041
  if ("theme" in options) this.updateTheme();
16612
17042
  if ("createRightHeaderActionComponent" in options || "createLeftHeaderActionComponent" in options || "createPrefixHeaderActionComponent" in options) {
16613
17043
  var _this$headerActionsSe;
@@ -16915,14 +17345,14 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16915
17345
  * @returns A JSON respresentation of the layout
16916
17346
  */
16917
17347
  toJSON() {
16918
- var _this$_floatingGroupS3, _this$_floatingGroupS4, _this$_popoutWindowSe9, _this$_popoutWindowSe10, _this$activeGroup2;
17348
+ var _this$_floatingGroupS3, _this$_floatingGroupS4, _this$_popoutWindowSe11, _this$_popoutWindowSe12, _this$activeGroup2;
16919
17349
  const data = this.gridview.serialize();
16920
17350
  const panels = this.panels.reduce((collection, panel) => {
16921
17351
  collection[panel.id] = panel.toJSON();
16922
17352
  return collection;
16923
17353
  }, {});
16924
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 : [];
16925
- 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 : [];
16926
17356
  const result = {
16927
17357
  grid: data,
16928
17358
  panels,
@@ -16961,8 +17391,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16961
17391
  this.mutation("load", () => this._doFromJSON(data, options));
16962
17392
  }
16963
17393
  _doFromJSON(data, options) {
16964
- var _this$_popoutWindowSe11, _data$grid$root;
16965
- (_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();
16966
17396
  if (typeof data !== "object" || data === null) throw new Error("dockview: serialized layout must be a non-null object");
16967
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");
16968
17398
  const existingPanels = /* @__PURE__ */ new Map();
@@ -17081,7 +17511,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17081
17511
  } else this.clear();
17082
17512
  const { grid, panels, activeGroup } = data;
17083
17513
  try {
17084
- var _data$floatingGroups, _data$popoutGroups, _this$_popoutWindowSe12, _this$_floatingGroupS5, _this$_watermarkServi2;
17514
+ var _data$floatingGroups, _data$popoutGroups, _this$_popoutWindowSe14, _this$_floatingGroupS5, _this$_watermarkServi2;
17085
17515
  const width = this.width;
17086
17516
  const height = this.height;
17087
17517
  const createGroupFromSerializedState = (data) => {
@@ -17146,7 +17576,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17146
17576
  if (data.edgeGroups) this.deserializeEdgeGroups(data.edgeGroups, panels, existingPanels, temporaryGroups);
17147
17577
  this.deserializeFloatingWindows((_data$floatingGroups = data.floatingGroups) !== null && _data$floatingGroups !== void 0 ? _data$floatingGroups : [], createGroupFromSerializedState);
17148
17578
  const popoutPromises = this.deserializePopoutWindows((_data$popoutGroups = data.popoutGroups) !== null && _data$popoutGroups !== void 0 ? _data$popoutGroups : [], createGroupFromSerializedState);
17149
- (_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);
17150
17580
  (_this$_floatingGroupS5 = this._floatingGroupService) === null || _this$_floatingGroupS5 === void 0 || _this$_floatingGroupS5.constrainBounds();
17151
17581
  if (typeof activeGroup === "string") {
17152
17582
  const panel = this.getPanel(activeGroup);
@@ -17314,15 +17744,13 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17314
17744
  }
17315
17745
  }
17316
17746
  const group = grid ? members[0] : createGroup(data);
17317
- return popoutService.scheduleRestoration(index * 100, () => {
17318
- this.addPopoutGroup(group, {
17319
- position: position !== null && position !== void 0 ? position : void 0,
17320
- overridePopoutGroup: gridReferenceGroup ? group : void 0,
17321
- overridePopoutGridview,
17322
- referenceGroup: gridReferenceGroup ? this.getPanel(gridReferenceGroup) : void 0,
17323
- popoutUrl: url
17324
- });
17325
- }, () => {
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
+ }), () => {
17326
17754
  for (const orphan of members.length > 0 ? members : [group]) if (!this.isDisposed && this._groups.has(orphan.id) && orphan.element.parentElement === null) {
17327
17755
  for (const panel of [...orphan.panels]) this.removePanel(panel, { removeEmptyGroup: false });
17328
17756
  orphan.dispose();
@@ -17557,7 +17985,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17557
17985
  * window.
17558
17986
  */
17559
17987
  detachFromNestedWindow(group) {
17560
- var _this$_floatingGroupS7, _this$_popoutWindowSe13;
17988
+ var _this$_floatingGroupS7, _this$_popoutWindowSe15;
17561
17989
  const floating = (_this$_floatingGroupS7 = this._floatingGroupService) === null || _this$_floatingGroupS7 === void 0 ? void 0 : _this$_floatingGroupS7.findByGroup(group);
17562
17990
  if (floating) {
17563
17991
  const members = this.nestedWindowMembers(group);
@@ -17566,7 +17994,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17566
17994
  if (floating.group === group) floating.setAnchorGroup(members.find((m) => m !== group));
17567
17995
  return true;
17568
17996
  }
17569
- 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);
17570
17998
  if (popout) {
17571
17999
  const members = this.nestedWindowMembers(group);
17572
18000
  if (members.length <= 1) return false;
@@ -17623,8 +18051,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17623
18051
  return group;
17624
18052
  }
17625
18053
  if (group.api.location.type === "popout") {
17626
- var _this$_popoutWindowSe14, _this$_popoutWindowSe15;
17627
- 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);
17628
18056
  if (!selectedGroup) throw new Error("dockview: failed to find popout group");
17629
18057
  if (this.detachFromNestedWindow(group)) {
17630
18058
  if (options === null || options === void 0 ? void 0 : options.skipDispose) group.model.location = { type: "grid" };
@@ -17641,7 +18069,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17641
18069
  this._groups.delete(group.id);
17642
18070
  this._onDidRemoveGroup.fire(group);
17643
18071
  }
17644
- (_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);
17645
18073
  const removedGroup = selectedGroup.disposable.dispose();
17646
18074
  if (!(options === null || options === void 0 ? void 0 : options.skipPopoutReturn) && removedGroup) {
17647
18075
  this.doAddGroup(removedGroup, [0]);
@@ -17668,10 +18096,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17668
18096
  debouncedUpdateAllPositions() {
17669
18097
  if (this._updatePositionsFrameId !== void 0) cancelAnimationFrame(this._updatePositionsFrameId);
17670
18098
  this._updatePositionsFrameId = requestAnimationFrame(() => {
17671
- var _this$_popoutWindowSe16, _this$_popoutWindowSe17;
18099
+ var _this$_popoutWindowSe18, _this$_popoutWindowSe19;
17672
18100
  this._updatePositionsFrameId = void 0;
17673
18101
  this.overlayRenderContainer.updateAllPositions();
17674
- 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();
17675
18103
  });
17676
18104
  }
17677
18105
  movingLock(func) {
@@ -17921,7 +18349,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17921
18349
  }
17922
18350
  }
17923
18351
  if (sourceGroup.api.location.type === "popout" && this.nestedWindowMembers(sourceGroup).length <= 1) {
17924
- var _this$_popoutWindowSe18;
18352
+ var _this$_popoutWindowSe20;
17925
18353
  /**
17926
18354
  * the source group is the only group in a popout window and
17927
18355
  * has a single panel
@@ -17936,7 +18364,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
17936
18364
  * Multi-group popout windows fall through to the generic
17937
18365
  * detach-and-re-add path so the window stays alive.
17938
18366
  */
17939
- 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);
17940
18368
  if (!popoutGroup) return;
17941
18369
  const removedPanel = this.movingLock(() => popoutGroup.popoutGroup.model.removePanel(popoutGroup.popoutGroup.panels[0], {
17942
18370
  skipSetActive: true,
@@ -18145,11 +18573,11 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
18145
18573
  break;
18146
18574
  }
18147
18575
  case "popout": {
18148
- var _this$_popoutWindowSe19, _this$_popoutWindowSe20;
18149
- 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);
18150
18578
  if (!selectedPopoutGroup) throw new Error("dockview: failed to find popout group");
18151
18579
  if (this.detachFromNestedWindow(from)) break;
18152
- (_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);
18153
18581
  if (selectedPopoutGroup.referenceGroup) {
18154
18582
  const referenceGroup = this.getPanel(selectedPopoutGroup.referenceGroup);
18155
18583
  if (referenceGroup && !referenceGroup.api.isVisible) this.doRemoveGroup(referenceGroup, { skipActive: true });
@@ -18314,8 +18742,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
18314
18742
  * window-local containers).
18315
18743
  */
18316
18744
  setGroupLocationForRoot(group, gridview) {
18317
- var _this$_popoutWindowSe21;
18318
- 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);
18319
18747
  if (popout) {
18320
18748
  if (group.model.renderContainer !== popout.overlayRenderContainer) group.model.renderContainer = popout.overlayRenderContainer;
18321
18749
  group.model.dropTargetContainer = popout.dropTargetContainer;
@@ -18335,10 +18763,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
18335
18763
  * the nested gridview of the floating / popout window it lives in.
18336
18764
  */
18337
18765
  getGridviewForGroup(group) {
18338
- var _this$_floatingGroupS10, _this$_popoutWindowSe22;
18766
+ var _this$_floatingGroupS10, _this$_popoutWindowSe24;
18339
18767
  const floating = (_this$_floatingGroupS10 = this._floatingGroupService) === null || _this$_floatingGroupS10 === void 0 ? void 0 : _this$_floatingGroupS10.findByGroup(group);
18340
18768
  if (floating) return floating.gridview;
18341
- 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);
18342
18770
  if (popout) return popout.gridview;
18343
18771
  return this.gridview;
18344
18772
  }
@@ -18360,13 +18788,13 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
18360
18788
  return location.length % 2 == 1 ? rootOrientation : orthogonal(rootOrientation);
18361
18789
  }
18362
18790
  updateTheme() {
18363
- 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;
18364
18792
  const theme = (_this$_options$theme = this._options.theme) !== null && _this$_options$theme !== void 0 ? _this$_options$theme : themeAbyss;
18365
18793
  (_this$_shellThemeClas = this._shellThemeClassnames) === null || _this$_shellThemeClas === void 0 || _this$_shellThemeClas.setClassNames(theme.className);
18366
18794
  const gap = (_theme$gap = theme.gap) !== null && _theme$gap !== void 0 ? _theme$gap : 0;
18367
18795
  this.gridview.margin = gap;
18368
18796
  for (const floating of this.floatingGroups) floating.gridview.margin = gap;
18369
- 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;
18370
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);
18371
18799
  if (theme.dndOverlayBorder === void 0) {
18372
18800
  var _this$_shellManager6;
@@ -18435,6 +18863,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
18435
18863
  }), this.onDidActiveChange((event) => {
18436
18864
  this._onDidActiveGroupChange.fire(event);
18437
18865
  }));
18866
+ this.layoutFromElement();
18438
18867
  }
18439
18868
  updateOptions(options) {
18440
18869
  super.updateOptions(options);
@@ -18680,6 +19109,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
18680
19109
  this._options = options;
18681
19110
  this.splitview = new Splitview(this.element, options);
18682
19111
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
19112
+ this.layoutFromElement();
18683
19113
  }
18684
19114
  updateOptions(options) {
18685
19115
  if ("className" in options) {
@@ -19361,11 +19791,13 @@ exports.createSplitview = createSplitview;
19361
19791
  exports.defineModule = defineModule;
19362
19792
  exports.directionToPosition = directionToPosition;
19363
19793
  exports.findRelativeZIndexParent = findRelativeZIndexParent;
19794
+ exports.getActiveElement = getActiveElement;
19364
19795
  exports.getDirectionOrientation = getDirectionOrientation;
19365
19796
  exports.getGridLocation = getGridLocation;
19366
19797
  exports.getLocationOrientation = getLocationOrientation;
19367
19798
  exports.getPaneData = getPaneData;
19368
19799
  exports.getPanelData = getPanelData;
19800
+ exports.getPopoutUrlError = getPopoutUrlError;
19369
19801
  exports.getRegisteredModules = getRegisteredModules;
19370
19802
  exports.getRelativeLocation = getRelativeLocation;
19371
19803
  exports.indexInParent = indexInParent;