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
  */
@@ -382,7 +382,7 @@ var FocusTracker = class extends CompositeDisposable {
382
382
  this._onDidBlur = new Emitter();
383
383
  this.onDidBlur = this._onDidBlur.event;
384
384
  this.addDisposables(this._onDidFocus, this._onDidBlur);
385
- let hasFocus = isAncestor(document.activeElement, element);
385
+ let hasFocus = isAncestor(getActiveElement(element), element);
386
386
  let loosingFocus = false;
387
387
  const onFocus = () => {
388
388
  loosingFocus = false;
@@ -404,7 +404,7 @@ var FocusTracker = class extends CompositeDisposable {
404
404
  }
405
405
  };
406
406
  this._refreshStateHandler = () => {
407
- if (isAncestor(document.activeElement, element) !== hasFocus) if (hasFocus) onBlur();
407
+ if (isAncestor(getActiveElement(element), element) !== hasFocus) if (hasFocus) onBlur();
408
408
  else onFocus();
409
409
  };
410
410
  this.addDisposables(addDisposableListener(element, "focus", onFocus, true));
@@ -421,6 +421,49 @@ function quasiPreventDefault(event) {
421
421
  function quasiDefaultPrevented(event) {
422
422
  return event[QUASI_PREVENT_DEFAULT_KEY];
423
423
  }
424
+ /** Whether the event originated within any of `elements`. Checks the
425
+ * composed path, so it also holds for elements inside a shadow root, which a
426
+ * window or document listener sees retargeted to the shadow host. */
427
+ function isEventWithin(event, elements) {
428
+ var _event$composedPath, _event$composedPath2;
429
+ 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 : [];
430
+ if (path.length > 0) return elements.some((el) => path.includes(el));
431
+ const target = event.target;
432
+ return target instanceof Node && elements.some((el) => el.contains(target));
433
+ }
434
+ /** Every shadow root between `element` and its document, innermost first. An
435
+ * element in a component nested inside another component sits in more than
436
+ * one, and an event is cut at each boundary. */
437
+ function shadowRootsOf(node) {
438
+ const roots = [];
439
+ let root = node.getRootNode();
440
+ while (isShadowRoot(root)) {
441
+ roots.push(root);
442
+ root = root.host.getRootNode();
443
+ }
444
+ return roots;
445
+ }
446
+ /**
447
+ * `element` as a listener rooted in `scope`'s tree sees it. A node in a shadow
448
+ * root *below* that tree is retargeted to its host there, repeatedly for
449
+ * nested roots; a node already in the same tree is returned unchanged. Omit
450
+ * `scope` (or pass a node in the document) for the document-level view, which
451
+ * is what a window listener gets.
452
+ *
453
+ * The scope matters: a layer living inside a shadow root must be able to tell
454
+ * its own elements apart, and retargeting everything out to the document would
455
+ * collapse them all onto the one host.
456
+ */
457
+ function retargetInto(element, scope) {
458
+ const scopeRoot = scope === null || scope === void 0 ? void 0 : scope.getRootNode();
459
+ let current = element;
460
+ let root = current.getRootNode();
461
+ while (root !== scopeRoot && isShadowRoot(root)) {
462
+ current = root.host;
463
+ root = current.getRootNode();
464
+ }
465
+ return current;
466
+ }
424
467
  function addStyles(document, styleSheetList, options = {}) {
425
468
  const styleSheets = Array.from(styleSheetList);
426
469
  const { nonce } = options;
@@ -431,6 +474,7 @@ function addStyles(document, styleSheetList, options = {}) {
431
474
  link.href = styleSheet.href;
432
475
  link.type = styleSheet.type;
433
476
  link.rel = "stylesheet";
477
+ if (resolvedNonce) link.setAttribute("nonce", resolvedNonce);
434
478
  document.head.appendChild(link);
435
479
  continue;
436
480
  }
@@ -470,6 +514,23 @@ function isInDocument(element) {
470
514
  else currentElement = currentElement.parentNode;
471
515
  return false;
472
516
  }
517
+ /** Duck-typed so it holds for a shadow root from another window's realm. */
518
+ function isShadowRoot(node) {
519
+ return !!node && node.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in node && !!node.host;
520
+ }
521
+ /**
522
+ * The document or shadow root to hit-test (`elementFromPoint` /
523
+ * `elementsFromPoint`) against for `node`. Hit-testing on the document stops
524
+ * at a shadow host, so when dockview is mounted in a shadow root it has to go
525
+ * through that root to reach its own elements. Falls back to the owning
526
+ * document (which may be a popout's) for a detached node.
527
+ */
528
+ function getHitTestRoot(node) {
529
+ var _node$ownerDocument;
530
+ const root = node.getRootNode();
531
+ if (root !== node && typeof root.elementsFromPoint === "function") return root;
532
+ return (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : document;
533
+ }
473
534
  function addTestId(element, id) {
474
535
  element.dataset.testid = id;
475
536
  }
@@ -504,6 +565,38 @@ function disableIframePointEvents(rootNode = document) {
504
565
  iframes.splice(0, iframes.length);
505
566
  } };
506
567
  }
568
+ /**
569
+ * Suppress text selection for the duration of a pointer drag.
570
+ *
571
+ * A pointer drag is just a held button as far as the browser is concerned, so
572
+ * it selects text under the cursor as it travels. HTML5 drag-and-drop is
573
+ * exempt - the browser owns the gesture - which is why this is only needed on
574
+ * the pointer backend.
575
+ *
576
+ * `user-select: none` alone is not enough on WebKit: it starts the selection
577
+ * gesture from a mousedown on a `user-select: none` element unless that
578
+ * element is also natively draggable, then extends it into whatever the
579
+ * pointer crosses. Cancelling `selectstart` refuses that first extension,
580
+ * which ends the gesture for the rest of the drag.
581
+ *
582
+ * An existing selection is left alone: a mousedown on a `user-select: none`
583
+ * element does not clear one natively, and a pointer drag should not either.
584
+ */
585
+ function disableTextSelection(rootNode = document) {
586
+ const doc = rootNode instanceof Document ? rootNode : rootNode.ownerDocument;
587
+ const root = doc === null || doc === void 0 ? void 0 : doc.documentElement;
588
+ if (!doc || !root) return { release: () => void 0 };
589
+ const properties = ["user-select", "-webkit-user-select"];
590
+ const previous = properties.map((name) => [name, root.style.getPropertyValue(name)]);
591
+ for (const name of properties) root.style.setProperty(name, "none");
592
+ const onSelectStart = (event) => event.preventDefault();
593
+ doc.addEventListener("selectstart", onSelectStart);
594
+ return { release: () => {
595
+ doc.removeEventListener("selectstart", onSelectStart);
596
+ for (const [name, value] of previous) if (value) root.style.setProperty(name, value);
597
+ else root.style.removeProperty(name);
598
+ } };
599
+ }
507
600
  function getDockviewTheme(element) {
508
601
  function toClassList(element) {
509
602
  const list = [];
@@ -515,6 +608,11 @@ function getDockviewTheme(element) {
515
608
  while (parent !== null) {
516
609
  theme = toClassList(parent).find((cls) => cls.startsWith("dockview-theme-"));
517
610
  if (typeof theme === "string") break;
611
+ if (parent.parentElement === null) {
612
+ const root = parent.getRootNode();
613
+ parent = isShadowRoot(root) ? root.host : null;
614
+ continue;
615
+ }
518
616
  parent = parent.parentElement;
519
617
  }
520
618
  return theme;
@@ -626,6 +724,285 @@ function resolveOpaqueBackground(element) {
626
724
  }
627
725
  return "";
628
726
  }
727
+ /** The focused element as seen from `node`'s own tree. Unlike
728
+ * `document.activeElement`, which is the shadow host when focus is inside a
729
+ * shadow root, this reaches into the root `node` lives in (and a popout's
730
+ * own document), while a web component nested inside that tree still
731
+ * resolves to its host there. */
732
+ function getActiveElement(node) {
733
+ var _root$activeElement;
734
+ const root = node.getRootNode();
735
+ const doc = root.nodeType === Node.DOCUMENT_NODE ? root : node.ownerDocument;
736
+ if (doc && typeof doc.hasFocus === "function" && !doc.hasFocus()) return null;
737
+ return (_root$activeElement = root.activeElement) !== null && _root$activeElement !== void 0 ? _root$activeElement : null;
738
+ }
739
+ /** Where to append a floating element (e.g. a drag ghost) for `node`: its
740
+ * shadow root when it lives in one, so styles scoped there still apply,
741
+ * otherwise the body of its own document (which may be a popout's). */
742
+ function getOverlayParent(node) {
743
+ var _node$ownerDocument2;
744
+ const root = node.getRootNode();
745
+ if (isShadowRoot(root)) return root;
746
+ return ((_node$ownerDocument2 = node.ownerDocument) !== null && _node$ownerDocument2 !== void 0 ? _node$ownerDocument2 : document).body;
747
+ }
748
+
749
+ //#endregion
750
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/asyncToGenerator.js
751
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
752
+ try {
753
+ var i = n[a](c), u = i.value;
754
+ } catch (n) {
755
+ e(n);
756
+ return;
757
+ }
758
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
759
+ }
760
+ function _asyncToGenerator(n) {
761
+ return function() {
762
+ var t = this, e = arguments;
763
+ return new Promise(function(r, o) {
764
+ var a = n.apply(t, e);
765
+ function _next(n) {
766
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
767
+ }
768
+ function _throw(n) {
769
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
770
+ }
771
+ _next(void 0);
772
+ });
773
+ };
774
+ }
775
+
776
+ //#endregion
777
+ //#region src/popoutWindow.ts
778
+ /**
779
+ * Throwing form of {@link getPopoutUrlError}, for callers with no way to
780
+ * recover from a refused URL.
781
+ */
782
+ function assertSameOriginPopoutUrl(url) {
783
+ const error = getPopoutUrlError(url);
784
+ if (error) throw error;
785
+ }
786
+ /**
787
+ * Schemes a popout must never open: each runs script in a context the browser
788
+ * still associates with the opener, or (for `file:`) has no origin to check.
789
+ */
790
+ const UNSAFE_POPOUT_PROTOCOLS = /* @__PURE__ */ new Set([
791
+ "javascript:",
792
+ "data:",
793
+ "blob:",
794
+ "vbscript:",
795
+ "file:"
796
+ ]);
797
+ /** How often an open popout window's `closed` flag is checked. */
798
+ const CLOSED_POLL_INTERVAL_MS = 250;
799
+ /**
800
+ * The reason `url` is unusable as a popout target, or `undefined` if it is
801
+ * allowed. Rejects anything that isn't same-origin with the page (scheme and
802
+ * host, so a packaged webview's own scheme such as `tauri://` qualifies), and
803
+ * the `javascript:`, `data:`, `blob:`, `vbscript:` and `file:` schemes that
804
+ * would otherwise execute in a context the browser still associates with the
805
+ * opener via `window.opener`.
806
+ *
807
+ * Callers that can recover from a refusal use this rather than catching, so it
808
+ * can be handled without a rejected promise. `page` is what the URL resolves
809
+ * against, and defaults to this page.
810
+ */
811
+ function getPopoutUrlError(url, page = globalThis.location) {
812
+ let resolved;
813
+ try {
814
+ resolved = new URL(url, page.href);
815
+ } catch (_unused) {
816
+ return /* @__PURE__ */ new Error(`dockview: invalid popout URL: ${url}`);
817
+ }
818
+ 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}`);
819
+ 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}`);
820
+ }
821
+ var PopoutWindow = class extends CompositeDisposable {
822
+ get window() {
823
+ var _this$_window$value, _this$_window;
824
+ 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;
825
+ }
826
+ /** Set when {@link open} resolved `null`, saying which way it failed. */
827
+ get failure() {
828
+ return this._failure;
829
+ }
830
+ constructor(target, className, options) {
831
+ super();
832
+ this.target = target;
833
+ this.className = className;
834
+ this.options = options;
835
+ this._onWillClose = new Emitter();
836
+ this.onWillClose = this._onWillClose.event;
837
+ this._onDidClose = new Emitter();
838
+ this.onDidClose = this._onDidClose.event;
839
+ this._window = null;
840
+ this.addDisposables(this._onWillClose, this._onDidClose, { dispose: () => {
841
+ this.close();
842
+ } });
843
+ }
844
+ dimensions() {
845
+ if (!this._window) return null;
846
+ const left = this._window.value.screenX;
847
+ return {
848
+ top: this._window.value.screenY,
849
+ left,
850
+ width: this._window.value.innerWidth,
851
+ height: this._window.value.innerHeight
852
+ };
853
+ }
854
+ close() {
855
+ var _this$options$onWillC, _this$options;
856
+ const current = this._window;
857
+ if (!current) return;
858
+ this._window = null;
859
+ this._onWillClose.fire();
860
+ (_this$options$onWillC = (_this$options = this.options).onWillClose) === null || _this$options$onWillC === void 0 || _this$options$onWillC.call(_this$options, {
861
+ id: this.target,
862
+ window: current.value
863
+ });
864
+ current.disposable.dispose();
865
+ this._onDidClose.fire();
866
+ }
867
+ open() {
868
+ var _this = this;
869
+ return _asyncToGenerator(function* () {
870
+ var _this$options$onDidOp, _this$options2;
871
+ if (_this._window) throw new Error("instance of popout window is already open");
872
+ const url = `${_this.options.url}`;
873
+ assertSameOriginPopoutUrl(url);
874
+ const features = Object.entries({
875
+ top: _this.options.top,
876
+ left: _this.options.left,
877
+ width: _this.options.width,
878
+ height: _this.options.height
879
+ }).map(([key, value]) => `${key}=${value}`).join(",");
880
+ /**
881
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open
882
+ */
883
+ const externalWindow = window.open(url, _this.target, features);
884
+ if (!externalWindow) {
885
+ _this._failure = { reason: "blocked" };
886
+ return null;
887
+ }
888
+ const disposable = new CompositeDisposable();
889
+ _this._window = {
890
+ value: externalWindow,
891
+ disposable
892
+ };
893
+ disposable.addDisposables(Disposable.from(() => {
894
+ externalWindow.close();
895
+ }), _this.watchForClose(externalWindow), addDisposableListener(globalThis.window, "beforeunload", () => {
896
+ /**
897
+ * before the main window closes we should close this popup too
898
+ * to be good citizens
899
+ *
900
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
901
+ */
902
+ _this.close();
903
+ }));
904
+ const container = _this.createPopoutWindowContainer();
905
+ if (_this.className) container.classList.add(_this.className);
906
+ (_this$options$onDidOp = (_this$options2 = _this.options).onDidOpen) === null || _this$options$onDidOp === void 0 || _this$options$onDidOp.call(_this$options2, {
907
+ id: _this.target,
908
+ window: externalWindow
909
+ });
910
+ return new Promise((resolve) => {
911
+ /**
912
+ * A host can answer `window.open` with a window in its own
913
+ * JavaScript context, which throws on first touch and cannot be
914
+ * filled with panel DOM. Settle as a blocked popup does, so the
915
+ * caller's fallback returns the group to the grid.
916
+ */
917
+ const abandon = (err) => {
918
+ _this._failure = {
919
+ reason: "unscriptable",
920
+ error: err instanceof Error ? err : new Error(String(err))
921
+ };
922
+ _this.close();
923
+ resolve(null);
924
+ };
925
+ try {
926
+ externalWindow.addEventListener("unload", () => {});
927
+ } catch (err) {
928
+ abandon(err);
929
+ return;
930
+ }
931
+ /**
932
+ * `load` is the only event that resolves this promise with a
933
+ * container, so a window that goes away first would leave the
934
+ * caller awaiting a promise that never settles - and
935
+ * `addPopoutGroup` holds its layout transaction open until it does.
936
+ * Settle with `null` on close, the same signal a blocked popup
937
+ * gives and one the caller already handles. `resolve` after the
938
+ * fact is a no-op, so a `load` that arrived first still wins.
939
+ */
940
+ disposable.addDisposables(_this.onWillClose(() => {
941
+ var _this$_failure;
942
+ (_this$_failure = _this._failure) !== null && _this$_failure !== void 0 || (_this._failure = { reason: "closed" });
943
+ resolve(null);
944
+ }));
945
+ externalWindow.addEventListener("load", () => {
946
+ /**
947
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
948
+ */
949
+ try {
950
+ var _globalThis$document$, _this$options$styleRo, _this$options3;
951
+ const externalDocument = externalWindow.document;
952
+ externalDocument.title = document.title;
953
+ externalDocument.body.appendChild(container);
954
+ addStyles(externalDocument, [...Array.from(globalThis.document.styleSheets), ...(_globalThis$document$ = globalThis.document.adoptedStyleSheets) !== null && _globalThis$document$ !== void 0 ? _globalThis$document$ : []], { nonce: _this.options.nonce });
955
+ const sheets = [];
956
+ 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()) {
957
+ var _root$styleSheets, _root$adoptedStyleShe;
958
+ 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 : []);
959
+ }
960
+ if (sheets.length > 0) addStyles(externalDocument, sheets, { nonce: _this.options.nonce });
961
+ /**
962
+ * beforeunload must be registered after load for reasons I could not determine
963
+ * otherwise the beforeunload event will not fire when the window is closed
964
+ */
965
+ addDisposableListener(externalWindow, "beforeunload", () => {
966
+ /**
967
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
968
+ */
969
+ _this.close();
970
+ });
971
+ resolve(container);
972
+ } catch (err) {
973
+ abandon(err);
974
+ }
975
+ });
976
+ });
977
+ })();
978
+ }
979
+ /**
980
+ * Backstop for the `beforeunload` signal, which a window torn down without
981
+ * running its unload handlers never sends: a native shell destroying the
982
+ * webview, or a browser discarding the page. `closed` is readable on any
983
+ * handle, cross-origin included. Whichever signal arrives first wins.
984
+ */
985
+ watchForClose(externalWindow) {
986
+ if (typeof externalWindow.closed !== "boolean") return Disposable.NONE;
987
+ const handle = setInterval(() => {
988
+ if (externalWindow.closed) this.close();
989
+ }, CLOSED_POLL_INTERVAL_MS);
990
+ return Disposable.from(() => {
991
+ clearInterval(handle);
992
+ });
993
+ }
994
+ createPopoutWindowContainer() {
995
+ const el = document.createElement("div");
996
+ el.classList.add("dv-popout-window");
997
+ el.id = "dv-popout-window";
998
+ el.style.position = "absolute";
999
+ el.style.width = "100%";
1000
+ el.style.height = "100%";
1001
+ el.style.top = "0px";
1002
+ el.style.left = "0px";
1003
+ return el;
1004
+ }
1005
+ };
629
1006
 
630
1007
  //#endregion
631
1008
  //#region src/array.ts
@@ -845,6 +1222,15 @@ var Splitview = class {
845
1222
  get proportions() {
846
1223
  return this._proportions ? [...this._proportions] : void 0;
847
1224
  }
1225
+ get proportionalLayout() {
1226
+ return this._proportionalLayout;
1227
+ }
1228
+ set proportionalLayout(value) {
1229
+ if (this._proportionalLayout === value) return;
1230
+ this._proportionalLayout = value;
1231
+ if (value) this.saveProportions();
1232
+ else this._proportions = void 0;
1233
+ }
848
1234
  get orientation() {
849
1235
  return this._orientation;
850
1236
  }
@@ -969,7 +1355,7 @@ var Splitview = class {
969
1355
  this._orientation = (_options$orientation = options.orientation) !== null && _options$orientation !== void 0 ? _options$orientation : "VERTICAL";
970
1356
  this.element = this.createContainer();
971
1357
  this.margin = (_options$margin = options.margin) !== null && _options$margin !== void 0 ? _options$margin : 0;
972
- this.proportionalLayout = options.proportionalLayout === void 0 ? true : !!options.proportionalLayout;
1358
+ this._proportionalLayout = options.proportionalLayout === void 0 ? true : !!options.proportionalLayout;
973
1359
  this.viewContainer = this.createViewContainer();
974
1360
  this.sashContainer = this.createSashContainer();
975
1361
  this.element.appendChild(this.sashContainer);
@@ -1693,10 +2079,18 @@ var BranchNode = class BranchNode extends CompositeDisposable {
1693
2079
  if (child instanceof BranchNode) child.margin = value;
1694
2080
  });
1695
2081
  }
2082
+ get proportionalLayout() {
2083
+ return this.splitview.proportionalLayout;
2084
+ }
2085
+ set proportionalLayout(value) {
2086
+ this.splitview.proportionalLayout = value;
2087
+ this.children.forEach((child) => {
2088
+ if (child instanceof BranchNode) child.proportionalLayout = value;
2089
+ });
2090
+ }
1696
2091
  constructor(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, margin, childDescriptors) {
1697
2092
  super();
1698
2093
  this.orientation = orientation;
1699
- this.proportionalLayout = proportionalLayout;
1700
2094
  this.styles = styles;
1701
2095
  this._childrenDisposable = Disposable.NONE;
1702
2096
  this.children = [];
@@ -2238,8 +2632,13 @@ var Gridview = class {
2238
2632
  }
2239
2633
  return findLeaf(this.root, reverse);
2240
2634
  }
2635
+ get proportionalLayout() {
2636
+ return this.root.proportionalLayout;
2637
+ }
2638
+ set proportionalLayout(value) {
2639
+ this.root.proportionalLayout = value;
2640
+ }
2241
2641
  constructor(proportionalLayout, styles, orientation, locked, margin) {
2242
- this.proportionalLayout = proportionalLayout;
2243
2642
  this.styles = styles;
2244
2643
  this._locked = false;
2245
2644
  this._margin = 0;
@@ -2433,6 +2832,25 @@ var Resizable = class extends CompositeDisposable {
2433
2832
  this.layout(width, height);
2434
2833
  }));
2435
2834
  }
2835
+ /**
2836
+ * Lay out from the element's current size.
2837
+ *
2838
+ * The ResizeObserver above only reports asynchronously, so between
2839
+ * construction and its first callback the component believes it has no
2840
+ * size - and anything built in that window (panels added right after
2841
+ * `createDockview`, say) resolves its sizes against zero and collapses to
2842
+ * minimums. Concrete components call this once they are fully constructed
2843
+ * so that work sees the real size. The same guards as the observer apply:
2844
+ * a detached or hidden element has no size worth propagating.
2845
+ */
2846
+ layoutFromElement() {
2847
+ if (this.disableResizing || !this._element.offsetParent) return;
2848
+ if (!isInDocument(this._element)) return;
2849
+ const width = Math.round(this._element.clientWidth);
2850
+ const height = Math.round(this._element.clientHeight);
2851
+ if (width === 0 || height === 0) return;
2852
+ this.layout(width, height);
2853
+ }
2436
2854
  };
2437
2855
 
2438
2856
  //#endregion
@@ -2533,7 +2951,10 @@ var BaseGrid = class extends Resizable {
2533
2951
  return this.gridview.isViewVisible(getGridLocation(panel.element));
2534
2952
  }
2535
2953
  updateOptions(options) {
2536
- if (typeof options.proportionalLayout === "boolean") {}
2954
+ if ("proportionalLayout" in options) {
2955
+ var _options$proportional;
2956
+ this.gridview.proportionalLayout = (_options$proportional = options.proportionalLayout) !== null && _options$proportional !== void 0 ? _options$proportional : true;
2957
+ }
2537
2958
  if (options.orientation) this.gridview.orientation = options.orientation;
2538
2959
  if ("styles" in options) {}
2539
2960
  if ("disableAutoResizing" in options) {
@@ -3342,6 +3763,15 @@ var DockviewApi = class {
3342
3763
  get onUnhandledDragOver() {
3343
3764
  return this.component.onUnhandledDragOver;
3344
3765
  }
3766
+ /**
3767
+ * The drag-and-drop backends currently live: `dndStrategy` resolved against
3768
+ * this device, which `'auto'` reads from the primary input device. Only an
3769
+ * HTML5 drag can leave the window it started in, so check `html5` before
3770
+ * relying on a drag between a popout window and the main window.
3771
+ */
3772
+ get dndCapabilities() {
3773
+ return this.component.dndCapabilities;
3774
+ }
3345
3775
  get onDidPopoutGroupSizeChange() {
3346
3776
  return this.component.onDidPopoutGroupSizeChange;
3347
3777
  }
@@ -3364,9 +3794,27 @@ var DockviewApi = class {
3364
3794
  get onDidRemovePopoutGroup() {
3365
3795
  return this.component.onDidRemovePopoutGroup;
3366
3796
  }
3797
+ /**
3798
+ * Fires when a popout window could not be used, carrying which way it
3799
+ * failed: the URL was refused, the browser blocked the window, the host
3800
+ * returned a window whose document the opener cannot reach, or it closed
3801
+ * before loading. The group stays in (or returns to) the main grid.
3802
+ */
3367
3803
  get onDidOpenPopoutWindowFail() {
3368
3804
  return this.component.onDidOpenPopoutWindowFail;
3369
3805
  }
3806
+ /**
3807
+ * Fires as dockview lets go of a popout window, while that window is still
3808
+ * open, carrying its live `Window` handle. Covers every popout the component
3809
+ * opened and every reason for closing one, disposal included;
3810
+ * {@link onDidAddPopoutGroup} is the opening half.
3811
+ *
3812
+ * For hosts that own their windows: in a desktop webview the page's own
3813
+ * `close()` can be a no-op, so the shell has to be told.
3814
+ */
3815
+ get onWillClosePopoutWindow() {
3816
+ return this.component.onWillClosePopoutWindow;
3817
+ }
3370
3818
  /** Enumerate the popout groups currently open in their own windows. */
3371
3819
  getPopouts() {
3372
3820
  return this.component.getPopouts();
@@ -4333,7 +4781,8 @@ function addGhostImage(dataTransfer, ghostElement, options) {
4333
4781
  var _options$ownerDocumen, _options$x, _options$y;
4334
4782
  addClasses(ghostElement, "dv-dragged");
4335
4783
  ghostElement.style.top = "-9999px";
4336
- ((_options$ownerDocumen = options === null || options === void 0 ? void 0 : options.ownerDocument) !== null && _options$ownerDocumen !== void 0 ? _options$ownerDocumen : document).body.appendChild(ghostElement);
4784
+ ghostElement.style.position = "absolute";
4785
+ ((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);
4337
4786
  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);
4338
4787
  setTimeout(() => {
4339
4788
  removeClasses(ghostElement, "dv-dragged");
@@ -4385,7 +4834,7 @@ var PointerDragController = class PointerDragController extends CompositeDisposa
4385
4834
  } };
4386
4835
  }
4387
4836
  beginDrag(args) {
4388
- var _source$ownerDocument, _source$ownerDocument2, _source$ownerDocument3;
4837
+ var _source$ownerDocument, _source$ownerDocument2, _source$ownerDocument3, _source$ownerDocument4;
4389
4838
  if (this._active) this.cancel();
4390
4839
  const { pointerEvent, source } = args;
4391
4840
  const dataDisposable = args.getData();
@@ -4401,13 +4850,14 @@ var PointerDragController = class PointerDragController extends CompositeDisposa
4401
4850
  this._dataDisposable = dataDisposable;
4402
4851
  this._ghost = args.ghost;
4403
4852
  this._iframeShield = disableIframePointEvents((_source$ownerDocument = source.ownerDocument) !== null && _source$ownerDocument !== void 0 ? _source$ownerDocument : document);
4853
+ this._selectionShield = disableTextSelection((_source$ownerDocument2 = source.ownerDocument) !== null && _source$ownerDocument2 !== void 0 ? _source$ownerDocument2 : document);
4404
4854
  const startEvent = {
4405
4855
  clientX: pointerEvent.clientX,
4406
4856
  clientY: pointerEvent.clientY,
4407
4857
  pointerEvent
4408
4858
  };
4409
4859
  this._onDragStart.fire(startEvent);
4410
- 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;
4860
+ 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;
4411
4861
  this._moveListener = addDisposableListener(targetWindow, "pointermove", (e) => {
4412
4862
  var _this$_active;
4413
4863
  if (e.pointerId !== ((_this$_active = this._active) === null || _this$_active === void 0 ? void 0 : _this$_active.pointerId)) return;
@@ -4444,8 +4894,7 @@ var PointerDragController = class PointerDragController extends CompositeDisposa
4444
4894
  }
4445
4895
  }
4446
4896
  _findTargetUnder(x, y) {
4447
- var _this$_active$source$, _this$_active4;
4448
- 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);
4897
+ const elements = (this._active ? getHitTestRoot(this._active.source) : document).elementsFromPoint(x, y);
4449
4898
  for (const el of elements) {
4450
4899
  let current = el;
4451
4900
  while (current) {
@@ -4495,7 +4944,7 @@ var PointerDragController = class PointerDragController extends CompositeDisposa
4495
4944
  this._onDragEnd.fire(dragEvent);
4496
4945
  }
4497
4946
  _teardown() {
4498
- var _this$_ghost2, _this$_iframeShield, _this$_moveListener, _this$_upListener, _this$_cancelListener;
4947
+ var _this$_ghost2, _this$_iframeShield, _this$_selectionShiel, _this$_moveListener, _this$_upListener, _this$_cancelListener;
4499
4948
  this._currentTarget = void 0;
4500
4949
  this._active = void 0;
4501
4950
  this._lastPointerEvent = void 0;
@@ -4505,6 +4954,8 @@ var PointerDragController = class PointerDragController extends CompositeDisposa
4505
4954
  this._ghost = void 0;
4506
4955
  (_this$_iframeShield = this._iframeShield) === null || _this$_iframeShield === void 0 || _this$_iframeShield.release();
4507
4956
  this._iframeShield = void 0;
4957
+ (_this$_selectionShiel = this._selectionShield) === null || _this$_selectionShiel === void 0 || _this$_selectionShiel.release();
4958
+ this._selectionShield = void 0;
4508
4959
  (_this$_moveListener = this._moveListener) === null || _this$_moveListener === void 0 || _this$_moveListener.dispose();
4509
4960
  (_this$_upListener = this._upListener) === null || _this$_upListener === void 0 || _this$_upListener.dispose();
4510
4961
  (_this$_cancelListener = this._cancelListener) === null || _this$_cancelListener === void 0 || _this$_cancelListener.dispose();
@@ -4773,9 +5224,10 @@ var PointerDragSource = class extends CompositeDisposable {
4773
5224
  return true;
4774
5225
  }
4775
5226
  _onPointerDown(event) {
4776
- var _ref, _this$options$thresho, _ref2, _this$element$ownerDo, _this$element$ownerDo2;
5227
+ var _this$element$ownerDo, _ref, _this$options$thresho, _ref2, _this$element$ownerDo2, _this$element$ownerDo3;
4777
5228
  if (!this._shouldHandle(event)) return;
4778
5229
  this._cancelPending();
5230
+ this._selectionShield = disableTextSelection((_this$element$ownerDo = this.element.ownerDocument) !== null && _this$element$ownerDo !== void 0 ? _this$element$ownerDo : document);
4779
5231
  this._pendingPointerId = event.pointerId;
4780
5232
  this._startX = event.clientX;
4781
5233
  this._startY = event.clientY;
@@ -4791,7 +5243,7 @@ var PointerDragSource = class extends CompositeDisposable {
4791
5243
  const threshold = (_this$options$thresho = this.options.threshold) !== null && _this$options$thresho !== void 0 ? _this$options$thresho : DEFAULT_THRESHOLD;
4792
5244
  const pressToleranceOpt = this.options.pressTolerance;
4793
5245
  const pressTolerance = (_ref2 = typeof pressToleranceOpt === "function" ? pressToleranceOpt() : pressToleranceOpt) !== null && _ref2 !== void 0 ? _ref2 : DEFAULT_PRESS_TOLERANCE;
4794
- const targetWindow = (_this$element$ownerDo = (_this$element$ownerDo2 = this.element.ownerDocument) === null || _this$element$ownerDo2 === void 0 ? void 0 : _this$element$ownerDo2.defaultView) !== null && _this$element$ownerDo !== void 0 ? _this$element$ownerDo : globalThis.window;
5246
+ const targetWindow = (_this$element$ownerDo2 = (_this$element$ownerDo3 = this.element.ownerDocument) === null || _this$element$ownerDo3 === void 0 ? void 0 : _this$element$ownerDo3.defaultView) !== null && _this$element$ownerDo2 !== void 0 ? _this$element$ownerDo2 : globalThis.window;
4795
5247
  this._pendingMoveListener = addDisposableListener(targetWindow, "pointermove", (moveEvent) => {
4796
5248
  if (moveEvent.pointerId !== this._pendingPointerId) return;
4797
5249
  const dx = moveEvent.clientX - this._startX;
@@ -4817,7 +5269,9 @@ var PointerDragSource = class extends CompositeDisposable {
4817
5269
  this._cancelPending();
4818
5270
  }
4819
5271
  _cancelPending() {
4820
- var _this$_pendingMoveLis, _this$_pendingUpListe, _this$_pendingCancelL;
5272
+ var _this$_selectionShiel, _this$_pendingMoveLis, _this$_pendingUpListe, _this$_pendingCancelL;
5273
+ (_this$_selectionShiel = this._selectionShield) === null || _this$_selectionShiel === void 0 || _this$_selectionShiel.release();
5274
+ this._selectionShield = void 0;
4821
5275
  this._pendingPointerId = void 0;
4822
5276
  if (this._armTimer !== void 0) {
4823
5277
  clearTimeout(this._armTimer);
@@ -4862,29 +5316,51 @@ var PointerDragSource = class extends CompositeDisposable {
4862
5316
  */
4863
5317
  var PointerGhost = class {
4864
5318
  constructor(opts) {
4865
- var _opts$offsetX, _opts$offsetY, _opts$opacity, _opts$owner$ownerDocu, _opts$owner;
5319
+ var _opts$offsetX, _opts$offsetY, _popover, _opts$opacity;
4866
5320
  this._disposed = false;
4867
5321
  this.element = opts.element;
4868
5322
  this.offsetX = (_opts$offsetX = opts.offsetX) !== null && _opts$offsetX !== void 0 ? _opts$offsetX : 0;
4869
5323
  this.offsetY = (_opts$offsetY = opts.offsetY) !== null && _opts$offsetY !== void 0 ? _opts$offsetY : 0;
4870
- this.element.style.position = "fixed";
4871
- this.element.style.left = "0px";
4872
- this.element.style.top = "0px";
4873
- this.element.style.pointerEvents = "none";
4874
- this.element.style.zIndex = "99999";
4875
- this.element.style.opacity = String((_opts$opacity = opts.opacity) !== null && _opts$opacity !== void 0 ? _opts$opacity : .8);
4876
- this.element.style.willChange = "transform";
4877
- this.element.style.transform = `translate3d(${opts.initialX - this.offsetX}px, ${opts.initialY - this.offsetY}px, 0)`;
4878
- ((_opts$owner$ownerDocu = (_opts$owner = opts.owner) === null || _opts$owner === void 0 ? void 0 : _opts$owner.ownerDocument) !== null && _opts$owner$ownerDocu !== void 0 ? _opts$owner$ownerDocu : document).body.appendChild(this.element);
5324
+ const parent = opts.owner ? getOverlayParent(opts.owner) : document.body;
5325
+ let popover;
5326
+ if (isShadowRoot(parent) && typeof this.element.showPopover === "function") {
5327
+ popover = this.element.ownerDocument.createElement("div");
5328
+ popover.popover = "manual";
5329
+ Object.assign(popover.style, {
5330
+ inset: "auto",
5331
+ margin: "0",
5332
+ padding: "0",
5333
+ border: "0",
5334
+ background: "transparent",
5335
+ color: "inherit",
5336
+ overflow: "visible"
5337
+ });
5338
+ popover.appendChild(this.element);
5339
+ this.element.style.pointerEvents = "none";
5340
+ this.element.style.transform = "none";
5341
+ }
5342
+ this.container = (_popover = popover) !== null && _popover !== void 0 ? _popover : this.element;
5343
+ const style = this.container.style;
5344
+ style.position = "fixed";
5345
+ style.left = "0px";
5346
+ style.top = "0px";
5347
+ style.pointerEvents = "none";
5348
+ style.zIndex = "99999";
5349
+ style.opacity = String((_opts$opacity = opts.opacity) !== null && _opts$opacity !== void 0 ? _opts$opacity : .8);
5350
+ style.willChange = "transform";
5351
+ style.transform = `translate3d(${opts.initialX - this.offsetX}px, ${opts.initialY - this.offsetY}px, 0)`;
5352
+ parent.appendChild(this.container);
5353
+ popover === null || popover === void 0 || popover.showPopover();
4879
5354
  }
4880
5355
  update(clientX, clientY) {
4881
5356
  if (this._disposed) return;
4882
- this.element.style.transform = `translate3d(${clientX - this.offsetX}px, ${clientY - this.offsetY}px, 0)`;
5357
+ this.container.style.transform = `translate3d(${clientX - this.offsetX}px, ${clientY - this.offsetY}px, 0)`;
4883
5358
  }
4884
5359
  dispose() {
4885
5360
  if (this._disposed) return;
4886
5361
  this._disposed = true;
4887
5362
  this.element.remove();
5363
+ if (this.container !== this.element) this.container.remove();
4888
5364
  }
4889
5365
  };
4890
5366
 
@@ -4921,7 +5397,8 @@ var Html5DragSource = class extends CompositeDisposable {
4921
5397
  addGhostImage(event.dataTransfer, ghost.element, {
4922
5398
  x: (_ghost$offsetX = ghost.offsetX) !== null && _ghost$offsetX !== void 0 ? _ghost$offsetX : 0,
4923
5399
  y: (_ghost$offsetY = ghost.offsetY) !== null && _ghost$offsetY !== void 0 ? _ghost$offsetY : 0,
4924
- ownerDocument: (_this$el$ownerDocumen2 = this.el.ownerDocument) !== null && _this$el$ownerDocumen2 !== void 0 ? _this$el$ownerDocumen2 : void 0
5400
+ ownerDocument: (_this$el$ownerDocumen2 = this.el.ownerDocument) !== null && _this$el$ownerDocumen2 !== void 0 ? _this$el$ownerDocumen2 : void 0,
5401
+ owner: this.el
4925
5402
  });
4926
5403
  if (ghost.dispose) {
4927
5404
  const disposeGhost = ghost.dispose;
@@ -5757,8 +6234,7 @@ var LongPressDetector = class extends CompositeDisposable {
5757
6234
  let guard;
5758
6235
  const timeout = setTimeout(() => guard === null || guard === void 0 ? void 0 : guard.dispose(), 500);
5759
6236
  guard = addDisposableListener(targetWindow, "click", (event) => {
5760
- const target = event.target;
5761
- if (target && this.element.contains(target)) {
6237
+ if (isEventWithin(event, [this.element])) {
5762
6238
  event.preventDefault();
5763
6239
  event.stopPropagation();
5764
6240
  }
@@ -5874,7 +6350,7 @@ var Tab = class extends CompositeDisposable {
5874
6350
  if (this.accessor.id === (data === null || data === void 0 ? void 0 : data.viewId)) {
5875
6351
  var _this$accessor$option;
5876
6352
  if (((_this$accessor$option = this.accessor.options.theme) === null || _this$accessor$option === void 0 ? void 0 : _this$accessor$option.tabAnimation) === "smooth") return false;
5877
- if (data.tabGroupId && this.group.model.getTabGroupForPanel(this.panel.id)) return false;
6353
+ if (data.tabGroupId && data.groupId === this.group.id && this.group.model.getTabGroupForPanel(this.panel.id)) return false;
5878
6354
  return true;
5879
6355
  }
5880
6356
  return this.group.model.canDisplayOverlay(event, position, "tab");
@@ -6487,6 +6963,7 @@ var DockviewUnhandledDragOverEvent = class extends AcceptableEvent {
6487
6963
  const PROPERTY_KEYS_DOCKVIEW = (() => {
6488
6964
  return Object.keys({
6489
6965
  disableAutoResizing: void 0,
6966
+ proportionalLayout: void 0,
6490
6967
  hideBorders: void 0,
6491
6968
  singleTabMode: void 0,
6492
6969
  disableFloatingGroups: void 0,
@@ -7340,10 +7817,16 @@ var TabGroupManager = class {
7340
7817
  (_entry$pointerDropTar = entry.pointerDropTarget) === null || _entry$pointerDropTar === void 0 || _entry$pointerDropTar.clearOverlay();
7341
7818
  }
7342
7819
  }
7343
- snapshotChipWidths() {
7344
- const widths = /* @__PURE__ */ new Map();
7345
- for (const [groupId, entry] of this._chipRenderers) widths.set(groupId, entry.chip.element.getBoundingClientRect().width);
7346
- return widths;
7820
+ /** Each chip's extent along the strip's main axis: width for a horizontal
7821
+ * header, height for a vertical one. */
7822
+ snapshotChipSizes() {
7823
+ const isVertical = this._ctx.getDirection() === "vertical";
7824
+ const sizes = /* @__PURE__ */ new Map();
7825
+ for (const [groupId, entry] of this._chipRenderers) {
7826
+ const rect = entry.chip.element.getBoundingClientRect();
7827
+ sizes.set(groupId, isVertical ? rect.height : rect.width);
7828
+ }
7829
+ return sizes;
7347
7830
  }
7348
7831
  positionUnderlines() {
7349
7832
  var _this$_indicator2;
@@ -7735,6 +8218,22 @@ var TabGroupManager = class {
7735
8218
  //#endregion
7736
8219
  //#region src/dockview/components/titlebar/tabReorderController.ts
7737
8220
  /**
8221
+ * Main-axis extent of a rect. Tabs flow along x in a horizontal header
8222
+ * (top/bottom) and along y in a vertical one (the left/right edge groups),
8223
+ * so the reorder math reads every size through this.
8224
+ */
8225
+ function mainAxisSize(rect, direction) {
8226
+ return direction === "vertical" ? rect.height : rect.width;
8227
+ }
8228
+ /** Leading edge of a rect along the main axis. */
8229
+ function mainAxisStart(rect, direction) {
8230
+ return direction === "vertical" ? rect.top : rect.left;
8231
+ }
8232
+ /** A cursor position projected onto the main axis. */
8233
+ function mainAxisCursor(event, direction) {
8234
+ return direction === "vertical" ? event.clientY : event.clientX;
8235
+ }
8236
+ /**
7738
8237
  * Tab drag-reorder + FLIP animation subsystem extracted from `Tabs`. The DOM
7739
8238
  * event wiring remains in `Tabs` and delegates the reorder/animation logic to
7740
8239
  * this controller. All access back into `Tabs` goes through
@@ -7829,14 +8328,30 @@ var TabReorderController = class extends CompositeDisposable {
7829
8328
  for (const tab of this._tabs) positions.set(tab.value.panel.id, tab.value.element.getBoundingClientRect());
7830
8329
  return positions;
7831
8330
  }
7832
- getAverageTabWidth() {
8331
+ /** Main-axis extent of a rect for this header's orientation. */
8332
+ _mainAxisSize(rect) {
8333
+ return mainAxisSize(rect, this._direction);
8334
+ }
8335
+ /** Main-axis leading edge of a rect for this header's orientation. */
8336
+ _mainAxisStart(rect) {
8337
+ return mainAxisStart(rect, this._direction);
8338
+ }
8339
+ /** The cursor coordinate along the main axis. */
8340
+ _mainAxisCoord(clientX, clientY) {
8341
+ return mainAxisCursor({
8342
+ clientX,
8343
+ clientY
8344
+ }, this._direction);
8345
+ }
8346
+ /** The margin that opens the insertion gap. It must run along the main
8347
+ * axis, so a vertical header pushes tabs down rather than sideways. */
8348
+ get _gapMarginProperty() {
8349
+ return this._direction === "vertical" ? "margin-top" : "margin-left";
8350
+ }
8351
+ getAverageTabSize() {
7833
8352
  if (this._tabs.length === 0) return 0;
7834
- const isVertical = this._direction === "vertical";
7835
8353
  let total = 0;
7836
- for (const tab of this._tabs) {
7837
- const rect = tab.value.element.getBoundingClientRect();
7838
- total += isVertical ? rect.height : rect.width;
7839
- }
8354
+ for (const tab of this._tabs) total += this._mainAxisSize(tab.value.element.getBoundingClientRect());
7840
8355
  return total / this._tabs.length;
7841
8356
  }
7842
8357
  /**
@@ -7846,8 +8361,7 @@ var TabReorderController = class extends CompositeDisposable {
7846
8361
  * `processDragOver` / `processDragLeave` helpers.
7847
8362
  */
7848
8363
  handlePointerDragMove(clientX, clientY) {
7849
- var _this$_tabsList$owner;
7850
- const elAtPoint = ((_this$_tabsList$owner = this._tabsList.ownerDocument) !== null && _this$_tabsList$owner !== void 0 ? _this$_tabsList$owner : document).elementFromPoint(clientX, clientY);
8364
+ const elAtPoint = getHitTestRoot(this._tabsList).elementFromPoint(clientX, clientY);
7851
8365
  if (!(!!elAtPoint && (this._tabsList.contains(elAtPoint) || !!this._extendedDropZone && this._extendedDropZone.contains(elAtPoint)))) {
7852
8366
  if (this._pointerInsideTabsList) {
7853
8367
  this._pointerInsideTabsList = false;
@@ -7876,8 +8390,7 @@ var TabReorderController = class extends CompositeDisposable {
7876
8390
  this.resetDragAnimation();
7877
8391
  }
7878
8392
  isPointInsideTabsList(clientX, clientY) {
7879
- var _this$_tabsList$owner2;
7880
- const el = ((_this$_tabsList$owner2 = this._tabsList.ownerDocument) !== null && _this$_tabsList$owner2 !== void 0 ? _this$_tabsList$owner2 : document).elementFromPoint(clientX, clientY);
8393
+ const el = getHitTestRoot(this._tabsList).elementFromPoint(clientX, clientY);
7881
8394
  return !!el && this._tabsList.contains(el);
7882
8395
  }
7883
8396
  /** Commit a smooth-mode intra-group reorder from the current insertion
@@ -7941,46 +8454,46 @@ var TabReorderController = class extends CompositeDisposable {
7941
8454
  const data = getPanelData();
7942
8455
  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;
7943
8456
  if (!data || !(data.panelId || data.tabGroupId) || data.groupId === this.group.id) return false;
7944
- const avgWidth = this.getAverageTabWidth();
7945
- this._animState = data.tabGroupId ? this._makeGroupDragAnimState(data, avgWidth) : this._makeTabDragAnimState(data, avgWidth);
8457
+ const avgSize = this.getAverageTabSize();
8458
+ this._animState = data.tabGroupId ? this._makeGroupDragAnimState(data, avgSize) : this._makeTabDragAnimState(data, avgSize);
7946
8459
  return true;
7947
8460
  }
7948
8461
  /** Anim state for an external group-chip drag (gap sized to the group). */
7949
- _makeGroupDragAnimState(data, avgWidth) {
8462
+ _makeGroupDragAnimState(data, avgSize) {
7950
8463
  var _sourceTg$panelIds$le;
7951
8464
  const sourceGroup = this.accessor.getPanel(data.groupId);
7952
8465
  const sourceTg = sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.getTabGroups().find((tg) => tg.id === data.tabGroupId);
7953
- 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;
8466
+ 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;
7954
8467
  return {
7955
8468
  sourceTabId: "",
7956
8469
  sourceIndex: -1,
7957
8470
  tabPositions: this.snapshotTabPositions(),
7958
- chipPositions: this._tabGroupManager.snapshotChipWidths(),
8471
+ chipSizes: this._tabGroupManager.snapshotChipSizes(),
7959
8472
  currentInsertionIndex: null,
7960
8473
  targetTabGroupId: null,
7961
8474
  sourceTabGroupId: data.tabGroupId,
7962
8475
  sourceGroupPanelIds: sourceTg ? new Set(sourceTg.panelIds) : /* @__PURE__ */ new Set(),
7963
- sourceChipWidth: avgWidth,
7964
- cursorOffsetFromDragLeft: groupGapWidth / 2,
7965
- sourceGapWidth: groupGapWidth,
7966
- containerLeft: this._tabsList.getBoundingClientRect().left
8476
+ sourceChipSize: avgSize,
8477
+ cursorOffsetFromDragStart: groupGapSize / 2,
8478
+ sourceGapSize: groupGapSize,
8479
+ containerStart: this._mainAxisStart(this._tabsList.getBoundingClientRect())
7967
8480
  };
7968
8481
  }
7969
8482
  /** Anim state for an external single-tab drag. */
7970
- _makeTabDragAnimState(data, avgWidth) {
8483
+ _makeTabDragAnimState(data, avgSize) {
7971
8484
  return {
7972
8485
  sourceTabId: data.panelId,
7973
8486
  sourceIndex: -1,
7974
8487
  tabPositions: this.snapshotTabPositions(),
7975
- chipPositions: this._tabGroupManager.snapshotChipWidths(),
8488
+ chipSizes: this._tabGroupManager.snapshotChipSizes(),
7976
8489
  currentInsertionIndex: null,
7977
8490
  targetTabGroupId: null,
7978
8491
  sourceTabGroupId: null,
7979
8492
  sourceGroupPanelIds: null,
7980
- sourceChipWidth: 0,
7981
- cursorOffsetFromDragLeft: avgWidth / 2,
7982
- sourceGapWidth: avgWidth,
7983
- containerLeft: this._tabsList.getBoundingClientRect().left
8493
+ sourceChipSize: 0,
8494
+ cursorOffsetFromDragStart: avgSize / 2,
8495
+ sourceGapSize: avgSize,
8496
+ containerStart: this._mainAxisStart(this._tabsList.getBoundingClientRect())
7984
8497
  };
7985
8498
  }
7986
8499
  /**
@@ -8023,19 +8536,19 @@ var TabReorderController = class extends CompositeDisposable {
8023
8536
  container === null || container === void 0 || (_container$model = container.model) === null || _container$model === void 0 || _container$model.clear();
8024
8537
  }
8025
8538
  handleDragOver(event) {
8026
- var _this$accessor$option2;
8539
+ var _event$clientY2, _this$accessor$option2;
8027
8540
  if (!this._animState) return;
8028
8541
  if (this._wrapMode && !this._animState.sourceTabGroupId) {
8029
8542
  var _event$clientY;
8030
8543
  this.handleWrappedDragOver(event.clientX, (_event$clientY = event.clientY) !== null && _event$clientY !== void 0 ? _event$clientY : 0);
8031
8544
  return;
8032
8545
  }
8033
- const mouseX = event.clientX;
8546
+ const mousePos = this._mainAxisCoord(event.clientX, (_event$clientY2 = event.clientY) !== null && _event$clientY2 !== void 0 ? _event$clientY2 : 0);
8034
8547
  const firstPanelToGroup = this._buildFirstPanelToGroupMap();
8035
- let insertionIndex = this._computeDragOverInsertionIndex(mouseX, firstPanelToGroup);
8548
+ let insertionIndex = this._computeDragOverInsertionIndex(mousePos, firstPanelToGroup);
8036
8549
  let targetTabGroupId = null;
8037
8550
  if (insertionIndex !== null && this._tabGroupManager.chipRenderers.size > 0) {
8038
- const resolved = this._resolveInsertionAgainstTabGroups(mouseX, insertionIndex, firstPanelToGroup);
8551
+ const resolved = this._resolveInsertionAgainstTabGroups(mousePos, insertionIndex, firstPanelToGroup);
8039
8552
  insertionIndex = resolved.insertionIndex;
8040
8553
  targetTabGroupId = resolved.targetTabGroupId;
8041
8554
  }
@@ -8059,14 +8572,15 @@ var TabReorderController = class extends CompositeDisposable {
8059
8572
  return firstPanelToGroup;
8060
8573
  }
8061
8574
  /**
8062
- * Walk the tabs left-to-right by their original widths and return the
8063
- * insertion slot for the drag image's left edge (null if no slot fits).
8575
+ * Walk the tabs in flow order by their original main-axis sizes and return
8576
+ * the insertion slot for the drag image's leading edge (null if no slot
8577
+ * fits).
8064
8578
  */
8065
- _computeDragOverInsertionIndex(mouseX, firstPanelToGroup) {
8579
+ _computeDragOverInsertionIndex(mousePos, firstPanelToGroup) {
8066
8580
  const animState = this._animState;
8067
8581
  const sourceGroupPanelIds = animState.sourceGroupPanelIds;
8068
- const availableSpace = mouseX - animState.cursorOffsetFromDragLeft - animState.containerLeft;
8069
- let accWidth = 0;
8582
+ const availableSpace = mousePos - animState.cursorOffsetFromDragStart - animState.containerStart;
8583
+ let accSize = 0;
8070
8584
  let insertionIndex = null;
8071
8585
  for (let i = 0; i < this._tabs.length; i++) {
8072
8586
  const tab = this._tabs[i].value;
@@ -8074,19 +8588,19 @@ var TabReorderController = class extends CompositeDisposable {
8074
8588
  if (sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(tab.panel.id)) continue;
8075
8589
  const groupId = firstPanelToGroup.get(tab.panel.id);
8076
8590
  if (groupId) {
8077
- var _animState$chipPositi;
8078
- const chipWidth = (_animState$chipPositi = animState.chipPositions.get(groupId)) !== null && _animState$chipPositi !== void 0 ? _animState$chipPositi : 0;
8079
- if (accWidth + chipWidth > availableSpace) {
8591
+ var _animState$chipSizes$;
8592
+ const chipSize = (_animState$chipSizes$ = animState.chipSizes.get(groupId)) !== null && _animState$chipSizes$ !== void 0 ? _animState$chipSizes$ : 0;
8593
+ if (accSize + chipSize > availableSpace) {
8080
8594
  var _insertionIndex;
8081
8595
  (_insertionIndex = insertionIndex) !== null && _insertionIndex !== void 0 || (insertionIndex = i);
8082
8596
  break;
8083
8597
  }
8084
- accWidth += chipWidth;
8598
+ accSize += chipSize;
8085
8599
  }
8086
8600
  const origRect = animState.tabPositions.get(tab.panel.id);
8087
- const tabWidth = origRect ? origRect.width : tab.element.getBoundingClientRect().width;
8088
- if (accWidth + tabWidth / 2 <= availableSpace) {
8089
- accWidth += tabWidth;
8601
+ const tabSize = this._mainAxisSize(origRect !== null && origRect !== void 0 ? origRect : tab.element.getBoundingClientRect());
8602
+ if (accSize + tabSize / 2 <= availableSpace) {
8603
+ accSize += tabSize;
8090
8604
  insertionIndex = i + 1;
8091
8605
  } else {
8092
8606
  var _insertionIndex2;
@@ -8097,11 +8611,12 @@ var TabReorderController = class extends CompositeDisposable {
8097
8611
  return insertionIndex;
8098
8612
  }
8099
8613
  /**
8100
- * Rebuild the accumulated original width up to `insertionIndex`, walking the
8101
- * tabs exactly the way the accumulation loop does, so callers know the
8102
- * original right edge of the chip (if any) that precedes the insertion slot.
8614
+ * Rebuild the accumulated original main-axis size up to `insertionIndex`,
8615
+ * walking the tabs exactly the way the accumulation loop does, so callers
8616
+ * know the original trailing edge of the chip (if any) that precedes the
8617
+ * insertion slot.
8103
8618
  */
8104
- _accumulatedWidthUpTo(insertionIndex, firstPanelToGroup) {
8619
+ _accumulatedSizeUpTo(insertionIndex, firstPanelToGroup) {
8105
8620
  const animState = this._animState;
8106
8621
  const sourceGroupPanelIds = animState.sourceGroupPanelIds;
8107
8622
  let accUpTo = 0;
@@ -8112,11 +8627,11 @@ var TabReorderController = class extends CompositeDisposable {
8112
8627
  if (i >= insertionIndex) break;
8113
8628
  const gid = firstPanelToGroup.get(tab.panel.id);
8114
8629
  if (gid) {
8115
- var _animState$chipPositi2;
8116
- accUpTo += (_animState$chipPositi2 = animState.chipPositions.get(gid)) !== null && _animState$chipPositi2 !== void 0 ? _animState$chipPositi2 : 0;
8630
+ var _animState$chipSizes$2;
8631
+ accUpTo += (_animState$chipSizes$2 = animState.chipSizes.get(gid)) !== null && _animState$chipSizes$2 !== void 0 ? _animState$chipSizes$2 : 0;
8117
8632
  }
8118
8633
  const origRect = animState.tabPositions.get(tab.panel.id);
8119
- accUpTo += origRect ? origRect.width : tab.element.getBoundingClientRect().width;
8634
+ accUpTo += this._mainAxisSize(origRect !== null && origRect !== void 0 ? origRect : tab.element.getBoundingClientRect());
8120
8635
  }
8121
8636
  return accUpTo;
8122
8637
  }
@@ -8124,11 +8639,11 @@ var TabReorderController = class extends CompositeDisposable {
8124
8639
  * Given a raw insertion index, snap it out of / into any tab group it falls
8125
8640
  * within and resolve the target group (if the drop should merge into one).
8126
8641
  */
8127
- _resolveInsertionAgainstTabGroups(mouseX, insertionIndex, firstPanelToGroup) {
8642
+ _resolveInsertionAgainstTabGroups(mousePos, insertionIndex, firstPanelToGroup) {
8128
8643
  const isGroupDrag = !!this._animState.sourceTabGroupId;
8129
- const accUpTo = this._accumulatedWidthUpTo(insertionIndex, firstPanelToGroup);
8644
+ const accUpTo = this._accumulatedSizeUpTo(insertionIndex, firstPanelToGroup);
8130
8645
  for (const tg of this.group.model.getTabGroups()) {
8131
- const resolved = this._evaluateTabGroupForInsertion(tg, mouseX, insertionIndex, accUpTo, isGroupDrag);
8646
+ const resolved = this._evaluateTabGroupForInsertion(tg, mousePos, insertionIndex, accUpTo, isGroupDrag);
8132
8647
  if (resolved) return resolved;
8133
8648
  }
8134
8649
  return {
@@ -8142,7 +8657,7 @@ var TabReorderController = class extends CompositeDisposable {
8142
8657
  * group governs the slot (the caller stops iterating), or `null` when the
8143
8658
  * group is irrelevant and the caller should keep looking.
8144
8659
  */
8145
- _evaluateTabGroupForInsertion(tg, mouseX, insertionIndex, accUpTo, isGroupDrag) {
8660
+ _evaluateTabGroupForInsertion(tg, mousePos, insertionIndex, accUpTo, isGroupDrag) {
8146
8661
  const range = this._resolveGroupRange(tg);
8147
8662
  if (!range) return null;
8148
8663
  const { firstIdx, lastIdx } = range;
@@ -8150,7 +8665,7 @@ var TabReorderController = class extends CompositeDisposable {
8150
8665
  const isJustBeforeGroup = !isInsideRange && insertionIndex === firstIdx - 1;
8151
8666
  if (!isInsideRange && !isJustBeforeGroup) return null;
8152
8667
  if (isGroupDrag) return this._resolveGroupDragTarget(insertionIndex, firstIdx, lastIdx, isInsideRange);
8153
- return this._resolveTabDragTarget(tg, mouseX, insertionIndex, accUpTo, firstIdx, isJustBeforeGroup);
8668
+ return this._resolveTabDragTarget(tg, mousePos, insertionIndex, accUpTo, firstIdx, isJustBeforeGroup);
8154
8669
  }
8155
8670
  /**
8156
8671
  * The index range this group occupies in the live tab list, excluding the
@@ -8185,13 +8700,13 @@ var TabReorderController = class extends CompositeDisposable {
8185
8700
  }
8186
8701
  /** Insertion target for a single-tab drag against a group: decide whether
8187
8702
  * the drop merges into the group based on the cursor vs the chip edge. */
8188
- _resolveTabDragTarget(tg, mouseX, insertionIndex, accUpTo, firstIdx, isJustBeforeGroup) {
8189
- var _animState$chipPositi3;
8703
+ _resolveTabDragTarget(tg, mousePos, insertionIndex, accUpTo, firstIdx, isJustBeforeGroup) {
8704
+ var _animState$chipSizes$3;
8190
8705
  const animState = this._animState;
8191
- const chipWidth = (_animState$chipPositi3 = animState.chipPositions.get(tg.id)) !== null && _animState$chipPositi3 !== void 0 ? _animState$chipPositi3 : 0;
8706
+ const chipSize = (_animState$chipSizes$3 = animState.chipSizes.get(tg.id)) !== null && _animState$chipSizes$3 !== void 0 ? _animState$chipSizes$3 : 0;
8192
8707
  if (isJustBeforeGroup) {
8193
8708
  if (!this._onlySourceBetween(insertionIndex, firstIdx)) return null;
8194
- if (mouseX >= (tg.collapsed ? animState.containerLeft + accUpTo + chipWidth / 2 : animState.containerLeft + accUpTo + chipWidth)) return {
8709
+ if (mousePos >= (tg.collapsed ? animState.containerStart + accUpTo + chipSize / 2 : animState.containerStart + accUpTo + chipSize)) return {
8195
8710
  insertionIndex: firstIdx,
8196
8711
  targetTabGroupId: tg.id
8197
8712
  };
@@ -8200,10 +8715,10 @@ var TabReorderController = class extends CompositeDisposable {
8200
8715
  targetTabGroupId: null
8201
8716
  };
8202
8717
  }
8203
- const chipOriginalRight = animState.containerLeft + accUpTo + chipWidth;
8718
+ const chipOriginalEnd = animState.containerStart + accUpTo + chipSize;
8204
8719
  if (insertionIndex === firstIdx) return {
8205
8720
  insertionIndex,
8206
- targetTabGroupId: mouseX >= chipOriginalRight ? tg.id : null
8721
+ targetTabGroupId: mousePos >= chipOriginalEnd ? tg.id : null
8207
8722
  };
8208
8723
  return {
8209
8724
  insertionIndex,
@@ -8366,17 +8881,17 @@ var TabReorderController = class extends CompositeDisposable {
8366
8881
  }
8367
8882
  if (this._pendingCollapse) return;
8368
8883
  const insertionIndex = this._animState.currentInsertionIndex;
8369
- const gapWidth = this._computeGapWidth();
8884
+ const gapSize = this._computeGapSize();
8370
8885
  const chipToShift = this._computeChipToShift(insertionIndex);
8371
- this._applyGapMargins(insertionIndex, gapWidth, chipToShift, skipTransition);
8886
+ this._applyGapMargins(insertionIndex, gapSize, chipToShift, skipTransition);
8372
8887
  }
8373
- /** Gap width for the current drag: the whole group's span for a group
8374
- * drag, otherwise the source tab's own width. */
8375
- _computeGapWidth() {
8888
+ /** Gap size for the current drag: the whole group's span for a group
8889
+ * drag, otherwise the source tab's own main-axis size. */
8890
+ _computeGapSize() {
8376
8891
  const animState = this._animState;
8377
- if (animState.sourceTabGroupId && animState.sourceGroupPanelIds) return animState.sourceGapWidth;
8892
+ if (animState.sourceTabGroupId && animState.sourceGroupPanelIds) return animState.sourceGapSize;
8378
8893
  const sourceRect = animState.tabPositions.get(animState.sourceTabId);
8379
- return sourceRect ? sourceRect.width : this.getAverageTabWidth();
8894
+ return sourceRect ? this._mainAxisSize(sourceRect) : this.getAverageTabSize();
8380
8895
  }
8381
8896
  /**
8382
8897
  * When the insertion lands at or before a group's first tab, the chip is
@@ -8420,7 +8935,7 @@ var TabReorderController = class extends CompositeDisposable {
8420
8935
  }
8421
8936
  /** Reset non-source chip margins, then apply the gap margin to the chip or
8422
8937
  * the first tab at/after the insertion index. */
8423
- _applyGapMargins(insertionIndex, gapWidth, chipToShift, skipTransition) {
8938
+ _applyGapMargins(insertionIndex, gapSize, chipToShift, skipTransition) {
8424
8939
  const animState = this._animState;
8425
8940
  const sourceGroupPanelIds = animState.sourceGroupPanelIds;
8426
8941
  let gapApplied = false;
@@ -8429,7 +8944,7 @@ var TabReorderController = class extends CompositeDisposable {
8429
8944
  this._clearMargin(entry.chip.element, skipTransition);
8430
8945
  }
8431
8946
  if (chipToShift) {
8432
- this._setMargin(chipToShift, `${gapWidth}px`, skipTransition);
8947
+ this._setMargin(chipToShift, `${gapSize}px`, skipTransition);
8433
8948
  gapApplied = true;
8434
8949
  }
8435
8950
  for (let i = 0; i < this._tabs.length; i++) {
@@ -8437,7 +8952,7 @@ var TabReorderController = class extends CompositeDisposable {
8437
8952
  if (tab.panel.id === animState.sourceTabId) continue;
8438
8953
  if (sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(tab.panel.id)) continue;
8439
8954
  if (!gapApplied && i >= insertionIndex) {
8440
- this._setMargin(tab.element, `${gapWidth}px`, skipTransition);
8955
+ this._setMargin(tab.element, `${gapSize}px`, skipTransition);
8441
8956
  gapApplied = true;
8442
8957
  } else this._clearMargin(tab.element, skipTransition);
8443
8958
  }
@@ -8447,31 +8962,33 @@ var TabReorderController = class extends CompositeDisposable {
8447
8962
  _shiftingClass(el) {
8448
8963
  return el.classList.contains("dv-tab-group-chip") ? "dv-tab-group-chip--shifting" : "dv-tab--shifting";
8449
8964
  }
8450
- /** Apply a margin-left value to an element, optionally bypassing CSS
8965
+ /** Apply the main-axis gap margin to an element, optionally bypassing CSS
8451
8966
  * transitions for instant positioning. */
8452
8967
  _setMargin(el, value, skipTransition) {
8968
+ const property = this._gapMarginProperty;
8453
8969
  if (skipTransition) {
8454
8970
  el.style.transition = "none";
8455
- el.style.marginLeft = value;
8971
+ el.style.setProperty(property, value);
8456
8972
  el.getBoundingClientRect();
8457
8973
  el.style.removeProperty("transition");
8458
- } else el.style.marginLeft = value;
8974
+ } else el.style.setProperty(property, value);
8459
8975
  toggleClass(el, this._shiftingClass(el), true);
8460
8976
  }
8461
8977
  /** Clear an element's gap margin, animating it back to zero unless
8462
8978
  * transitions are skipped. */
8463
8979
  _clearMargin(el, skipTransition) {
8464
8980
  const cls = this._shiftingClass(el);
8981
+ const property = this._gapMarginProperty;
8465
8982
  const prev = this._pendingMarginCleanups.get(el);
8466
8983
  if (prev) prev();
8467
- if (skipTransition || !el.style.marginLeft) {
8468
- el.style.removeProperty("margin-left");
8984
+ if (skipTransition || !el.style.getPropertyValue(property)) {
8985
+ el.style.removeProperty(property);
8469
8986
  toggleClass(el, cls, false);
8470
8987
  } else {
8471
- el.style.marginLeft = "0px";
8988
+ el.style.setProperty(property, "0px");
8472
8989
  toggleClass(el, cls, true);
8473
8990
  const onEnd = () => {
8474
- el.style.removeProperty("margin-left");
8991
+ el.style.removeProperty(property);
8475
8992
  toggleClass(el, cls, false);
8476
8993
  el.removeEventListener("transitionend", onEnd);
8477
8994
  clearTimeout(fallbackTimer);
@@ -8496,6 +9013,7 @@ var TabReorderController = class extends CompositeDisposable {
8496
9013
  }
8497
9014
  for (const [, entry] of this._tabGroupManager.chipRenderers) {
8498
9015
  entry.chip.element.style.removeProperty("margin-left");
9016
+ entry.chip.element.style.removeProperty("margin-top");
8499
9017
  toggleClass(entry.chip.element, "dv-tab-group-chip--shifting", false);
8500
9018
  }
8501
9019
  this._tabGroupManager.positionUnderlines();
@@ -9090,21 +9608,21 @@ var Tabs = class extends CompositeDisposable {
9090
9608
  panel
9091
9609
  });
9092
9610
  if (((_this$accessor$option2 = this.accessor.options.theme) === null || _this$accessor$option2 === void 0 ? void 0 : _this$accessor$option2.tabAnimation) === "smooth") {
9093
- const tabWidth = tab.element.getBoundingClientRect().width;
9611
+ const tabSize = mainAxisSize(tab.element.getBoundingClientRect(), this._direction);
9094
9612
  const sourceIndex = this._tabs.findIndex((x) => x.value === tab);
9095
9613
  this._animState = {
9096
9614
  sourceTabId: panel.id,
9097
9615
  sourceIndex,
9098
9616
  tabPositions: this.snapshotTabPositions(),
9099
- chipPositions: this._tabGroupManager.snapshotChipWidths(),
9617
+ chipSizes: this._tabGroupManager.snapshotChipSizes(),
9100
9618
  currentInsertionIndex: null,
9101
9619
  targetTabGroupId: null,
9102
9620
  sourceTabGroupId: null,
9103
9621
  sourceGroupPanelIds: null,
9104
- sourceChipWidth: 0,
9105
- cursorOffsetFromDragLeft: tabWidth / 2,
9106
- sourceGapWidth: tabWidth,
9107
- containerLeft: this._tabsList.getBoundingClientRect().left
9622
+ sourceChipSize: 0,
9623
+ cursorOffsetFromDragStart: tabSize / 2,
9624
+ sourceGapSize: tabSize,
9625
+ containerStart: mainAxisStart(this._tabsList.getBoundingClientRect(), this._direction)
9108
9626
  };
9109
9627
  this._pendingCollapse = true;
9110
9628
  requestAnimationFrame(() => {
@@ -9200,7 +9718,7 @@ var Tabs = class extends CompositeDisposable {
9200
9718
  this._tabGroupManager.positionAllChips();
9201
9719
  if (this._animState) {
9202
9720
  this._animState.tabPositions = this.snapshotTabPositions();
9203
- this._animState.chipPositions = this._tabGroupManager.snapshotChipWidths();
9721
+ this._animState.chipSizes = this._tabGroupManager.snapshotChipSizes();
9204
9722
  this.applyDragOverTransforms();
9205
9723
  }
9206
9724
  }
@@ -9222,7 +9740,7 @@ var Tabs = class extends CompositeDisposable {
9222
9740
  }
9223
9741
  if (this._animState) {
9224
9742
  this._animState.tabPositions = this.snapshotTabPositions();
9225
- this._animState.chipPositions = this._tabGroupManager.snapshotChipWidths();
9743
+ this._animState.chipSizes = this._tabGroupManager.snapshotChipSizes();
9226
9744
  this.applyDragOverTransforms();
9227
9745
  }
9228
9746
  }
@@ -9300,24 +9818,24 @@ var Tabs = class extends CompositeDisposable {
9300
9818
  const firstPanelId = tabGroup.panelIds[0];
9301
9819
  const firstIdx = firstPanelId ? this._tabs.findIndex((t) => t.value.panel.id === firstPanelId) : -1;
9302
9820
  const chipRect = chip.element.getBoundingClientRect();
9303
- let groupGapWidth = chipRect.width;
9821
+ let groupGapSize = mainAxisSize(chipRect, this._direction);
9304
9822
  for (const pid of tabGroup.panelIds) {
9305
9823
  const tabEntry = this._tabMap.get(pid);
9306
- if (tabEntry) groupGapWidth += tabEntry.value.element.getBoundingClientRect().width;
9824
+ if (tabEntry) groupGapSize += mainAxisSize(tabEntry.value.element.getBoundingClientRect(), this._direction);
9307
9825
  }
9308
9826
  this._animState = {
9309
9827
  sourceTabId: "",
9310
9828
  sourceIndex: firstIdx,
9311
9829
  tabPositions: this.snapshotTabPositions(),
9312
- chipPositions: this._tabGroupManager.snapshotChipWidths(),
9830
+ chipSizes: this._tabGroupManager.snapshotChipSizes(),
9313
9831
  currentInsertionIndex: null,
9314
9832
  targetTabGroupId: null,
9315
9833
  sourceTabGroupId: tabGroup.id,
9316
9834
  sourceGroupPanelIds: new Set(tabGroup.panelIds),
9317
- sourceChipWidth: chipRect.width,
9318
- cursorOffsetFromDragLeft: event.clientX - chipRect.left,
9319
- sourceGapWidth: groupGapWidth,
9320
- containerLeft: this._tabsList.getBoundingClientRect().left
9835
+ sourceChipSize: mainAxisSize(chipRect, this._direction),
9836
+ cursorOffsetFromDragStart: mainAxisCursor(event, this._direction) - mainAxisStart(chipRect, this._direction),
9837
+ sourceGapSize: groupGapSize,
9838
+ containerStart: mainAxisStart(this._tabsList.getBoundingClientRect(), this._direction)
9321
9839
  };
9322
9840
  if (((_this$accessor$option4 = this.accessor.options.theme) === null || _this$accessor$option4 === void 0 ? void 0 : _this$accessor$option4.tabAnimation) !== "smooth") return;
9323
9841
  const groupPanelIds = new Set(tabGroup.panelIds);
@@ -10075,8 +10593,10 @@ var DockviewGroupPanelModel = class extends CompositeDisposable {
10075
10593
  return this.tabsContainer.getPanelForTab(element);
10076
10594
  }
10077
10595
  get isContentFocused() {
10078
- if (!document.activeElement) return false;
10079
- return isAncestor(document.activeElement, this.contentContainer.element);
10596
+ const element = this.contentContainer.element;
10597
+ const activeElement = getActiveElement(element);
10598
+ if (!activeElement) return false;
10599
+ return isAncestor(activeElement, element);
10080
10600
  }
10081
10601
  get headerPosition() {
10082
10602
  var _this$_headerPosition;
@@ -12987,6 +13507,12 @@ var PopoutWindowService = class {
12987
13507
  observer.observe(gridview.element);
12988
13508
  return { dispose: () => observer.disconnect() };
12989
13509
  }
13510
+ /**
13511
+ * Runs `work` after `delayMs`, resolving once it has finished. Work that
13512
+ * returns a promise is awaited, so a caller holding
13513
+ * `restorationPromise` waits for the popout window itself rather than
13514
+ * only for the timer that starts it.
13515
+ */
12990
13516
  scheduleRestoration(delayMs, work, onCancel) {
12991
13517
  return new Promise((resolve) => {
12992
13518
  const cleanup = () => {
@@ -13001,8 +13527,7 @@ var PopoutWindowService = class {
13001
13527
  resolve();
13002
13528
  return;
13003
13529
  }
13004
- work();
13005
- resolve();
13530
+ Promise.resolve(work()).then(() => resolve(), () => resolve());
13006
13531
  }, delayMs);
13007
13532
  this._restorationCleanups.add(cleanup);
13008
13533
  });
@@ -14260,188 +14785,6 @@ var OverlayRenderContainer = class extends CompositeDisposable {
14260
14785
  }
14261
14786
  };
14262
14787
 
14263
- //#endregion
14264
- //#region \0@oxc-project+runtime@0.139.0/helpers/esm/asyncToGenerator.js
14265
- function asyncGeneratorStep(n, t, e, r, o, a, c) {
14266
- try {
14267
- var i = n[a](c), u = i.value;
14268
- } catch (n) {
14269
- e(n);
14270
- return;
14271
- }
14272
- i.done ? t(u) : Promise.resolve(u).then(r, o);
14273
- }
14274
- function _asyncToGenerator(n) {
14275
- return function() {
14276
- var t = this, e = arguments;
14277
- return new Promise(function(r, o) {
14278
- var a = n.apply(t, e);
14279
- function _next(n) {
14280
- asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
14281
- }
14282
- function _throw(n) {
14283
- asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
14284
- }
14285
- _next(void 0);
14286
- });
14287
- };
14288
- }
14289
-
14290
- //#endregion
14291
- //#region src/popoutWindow.ts
14292
- /**
14293
- * Reject popout URLs that aren't same-origin http(s). Blocks `javascript:`,
14294
- * `data:`, `blob:`, `vbscript:`, and cross-origin URLs that would otherwise
14295
- * execute in a context the browser still associates with the opener via
14296
- * `window.opener`.
14297
- */
14298
- function assertSameOriginPopoutUrl(url) {
14299
- let resolved;
14300
- try {
14301
- resolved = new URL(url, globalThis.location.href);
14302
- } catch (_unused) {
14303
- throw new Error(`dockview: invalid popout URL: ${url}`);
14304
- }
14305
- 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}`);
14306
- }
14307
- var PopoutWindow = class extends CompositeDisposable {
14308
- get window() {
14309
- var _this$_window$value, _this$_window;
14310
- 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;
14311
- }
14312
- constructor(target, className, options) {
14313
- super();
14314
- this.target = target;
14315
- this.className = className;
14316
- this.options = options;
14317
- this._onWillClose = new Emitter();
14318
- this.onWillClose = this._onWillClose.event;
14319
- this._onDidClose = new Emitter();
14320
- this.onDidClose = this._onDidClose.event;
14321
- this._window = null;
14322
- this.addDisposables(this._onWillClose, this._onDidClose, { dispose: () => {
14323
- this.close();
14324
- } });
14325
- }
14326
- dimensions() {
14327
- if (!this._window) return null;
14328
- const left = this._window.value.screenX;
14329
- return {
14330
- top: this._window.value.screenY,
14331
- left,
14332
- width: this._window.value.innerWidth,
14333
- height: this._window.value.innerHeight
14334
- };
14335
- }
14336
- close() {
14337
- if (this._window) {
14338
- var _this$options$onWillC, _this$options;
14339
- this._onWillClose.fire();
14340
- (_this$options$onWillC = (_this$options = this.options).onWillClose) === null || _this$options$onWillC === void 0 || _this$options$onWillC.call(_this$options, {
14341
- id: this.target,
14342
- window: this._window.value
14343
- });
14344
- this._window.disposable.dispose();
14345
- this._window = null;
14346
- this._onDidClose.fire();
14347
- }
14348
- }
14349
- open() {
14350
- var _this = this;
14351
- return _asyncToGenerator(function* () {
14352
- var _this$options$onDidOp, _this$options2;
14353
- if (_this._window) throw new Error("instance of popout window is already open");
14354
- const url = `${_this.options.url}`;
14355
- assertSameOriginPopoutUrl(url);
14356
- const features = Object.entries({
14357
- top: _this.options.top,
14358
- left: _this.options.left,
14359
- width: _this.options.width,
14360
- height: _this.options.height
14361
- }).map(([key, value]) => `${key}=${value}`).join(",");
14362
- /**
14363
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open
14364
- */
14365
- const externalWindow = window.open(url, _this.target, features);
14366
- if (!externalWindow)
14367
- /**
14368
- * Popup blocked
14369
- */
14370
- return null;
14371
- const disposable = new CompositeDisposable();
14372
- _this._window = {
14373
- value: externalWindow,
14374
- disposable
14375
- };
14376
- disposable.addDisposables(Disposable.from(() => {
14377
- externalWindow.close();
14378
- }), addDisposableListener(globalThis.window, "beforeunload", () => {
14379
- /**
14380
- * before the main window closes we should close this popup too
14381
- * to be good citizens
14382
- *
14383
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
14384
- */
14385
- _this.close();
14386
- }));
14387
- const container = _this.createPopoutWindowContainer();
14388
- if (_this.className) container.classList.add(_this.className);
14389
- (_this$options$onDidOp = (_this$options2 = _this.options).onDidOpen) === null || _this$options$onDidOp === void 0 || _this$options$onDidOp.call(_this$options2, {
14390
- id: _this.target,
14391
- window: externalWindow
14392
- });
14393
- return new Promise((resolve, reject) => {
14394
- externalWindow.addEventListener("unload", () => {});
14395
- /**
14396
- * `load` is the only event that resolves this promise with a
14397
- * container, so a window that goes away first would leave the
14398
- * caller awaiting a promise that never settles - and
14399
- * `addPopoutGroup` holds its layout transaction open until it does.
14400
- * Settle with `null` on close, the same signal a blocked popup
14401
- * gives and one the caller already handles. `resolve` after the
14402
- * fact is a no-op, so a `load` that arrived first still wins.
14403
- */
14404
- disposable.addDisposables(_this.onWillClose(() => resolve(null)));
14405
- externalWindow.addEventListener("load", () => {
14406
- /**
14407
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
14408
- */
14409
- try {
14410
- const externalDocument = externalWindow.document;
14411
- externalDocument.title = document.title;
14412
- externalDocument.body.appendChild(container);
14413
- addStyles(externalDocument, globalThis.document.styleSheets, { nonce: _this.options.nonce });
14414
- /**
14415
- * beforeunload must be registered after load for reasons I could not determine
14416
- * otherwise the beforeunload event will not fire when the window is closed
14417
- */
14418
- addDisposableListener(externalWindow, "beforeunload", () => {
14419
- /**
14420
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
14421
- */
14422
- _this.close();
14423
- });
14424
- resolve(container);
14425
- } catch (err) {
14426
- reject(err);
14427
- }
14428
- });
14429
- });
14430
- })();
14431
- }
14432
- createPopoutWindowContainer() {
14433
- const el = document.createElement("div");
14434
- el.classList.add("dv-popout-window");
14435
- el.id = "dv-popout-window";
14436
- el.style.position = "absolute";
14437
- el.style.width = "100%";
14438
- el.style.height = "100%";
14439
- el.style.top = "0px";
14440
- el.style.left = "0px";
14441
- return el;
14442
- }
14443
- };
14444
-
14445
14788
  //#endregion
14446
14789
  //#region src/dockview/strictEventsSequencing.ts
14447
14790
  var StrictEventsSequencing = class extends CompositeDisposable {
@@ -14485,8 +14828,8 @@ function isCoarsePrimaryInput(win) {
14485
14828
  * peeks): while it lives it watches a configurable set of dismiss signals
14486
14829
  * (Escape / extra keys, outside-pointerdown with an optional grace window,
14487
14830
  * window resize, focus moving outside) and calls `onDismiss`. Inside/outside is
14488
- * decided by an `isInside` predicate (geometry) or a `contains` check against
14489
- * `elements`. Dispose to detach every listener.
14831
+ * decided by an `isInside` predicate (geometry) or by checking the event's
14832
+ * composed path against `elements`. Dispose to detach every listener.
14490
14833
  *
14491
14834
  * It owns only the *signals*, not the surface element, its position, or any
14492
14835
  * hover/keep-open policy, so callers keep their own element lifecycle and
@@ -14506,9 +14849,7 @@ function createDismissableLayer(options) {
14506
14849
  const isInside = (event) => {
14507
14850
  var _options$elements, _options$elements2;
14508
14851
  if (options.isInside) return options.isInside(event);
14509
- const target = event.target;
14510
- if (!(target instanceof Node)) return false;
14511
- 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));
14852
+ 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 : []);
14512
14853
  };
14513
14854
  if (escape || keys.length > 0) disposables.addDisposables(addDisposableListener(win, "keydown", (event) => {
14514
14855
  if (escape && event.key === "Escape" || keys.includes(event.key)) options.onDismiss();
@@ -14527,17 +14868,45 @@ function createDismissableLayer(options) {
14527
14868
  options.onDismiss();
14528
14869
  }));
14529
14870
  if (options.focusOut) {
14530
- const isFocusInside = (focused) => {
14531
- var _options$elements3, _options$elements4;
14532
- if (options.isFocusInside) return options.isFocusInside(focused);
14533
- 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));
14871
+ /** A node in the layer's own tree, to scope retargeting and to locate
14872
+ * the shadow roots to listen on. */
14873
+ const layerScope = () => {
14874
+ var _options$anchor, _options$anchor2, _options$elements3;
14875
+ 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];
14534
14876
  };
14877
+ const seen = /* @__PURE__ */ new WeakSet();
14535
14878
  const onFocusIn = (event) => {
14879
+ var _options$elements4, _options$elements5;
14880
+ if (seen.has(event)) return;
14881
+ seen.add(event);
14536
14882
  const target = event.target;
14537
- if (target instanceof Element && !isFocusInside(target)) options.onDismiss();
14883
+ if (!(target instanceof Element)) return;
14884
+ 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();
14538
14885
  };
14539
- win.addEventListener("focusin", onFocusIn, capture);
14540
- disposables.addDisposables({ dispose: () => win.removeEventListener("focusin", onFocusIn, capture) });
14886
+ const bound = /* @__PURE__ */ new Map();
14887
+ const syncShadowRoots = () => {
14888
+ var _options$anchor3, _options$elements6, _options$elements7;
14889
+ const wanted = /* @__PURE__ */ new Set();
14890
+ const anchor = (_options$anchor3 = options.anchor) === null || _options$anchor3 === void 0 ? void 0 : _options$anchor3.call(options);
14891
+ 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] : []];
14892
+ for (const node of sources) for (const root of shadowRootsOf(node)) wanted.add(root);
14893
+ for (const [root, listener] of bound) if (!wanted.has(root)) {
14894
+ listener.dispose();
14895
+ bound.delete(root);
14896
+ }
14897
+ for (const root of wanted) {
14898
+ if (bound.has(root)) continue;
14899
+ bound.set(root, addDisposableListener(root, "focusin", onFocusIn, capture));
14900
+ }
14901
+ };
14902
+ disposables.addDisposables(addDisposableListener(win, "focusin", (event) => {
14903
+ syncShadowRoots();
14904
+ onFocusIn(event);
14905
+ }, capture), { dispose: () => {
14906
+ for (const [, listener] of bound) listener.dispose();
14907
+ bound.clear();
14908
+ } });
14909
+ syncShadowRoots();
14541
14910
  }
14542
14911
  return disposables;
14543
14912
  }
@@ -15030,6 +15399,24 @@ var ShellManager = class {
15030
15399
  this.updateTheme(this._gap, this._defaultCollapsedSize);
15031
15400
  return view;
15032
15401
  }
15402
+ /**
15403
+ * Lay out from the shell's current size.
15404
+ *
15405
+ * The ResizeObserver above only reports asynchronously, so between
15406
+ * construction and its first callback the shell believes it has no size -
15407
+ * and any layout built in that window (panels added straight after
15408
+ * `createDockview`, say) resolves its sizes against zero and collapses to
15409
+ * minimums, permanently. Seeding the size synchronously gives that work
15410
+ * the real dimensions. Same guards as the observer: a detached or hidden
15411
+ * shell has no size worth propagating.
15412
+ */
15413
+ layoutFromElement() {
15414
+ if (!this._shellElement.offsetParent || !isInDocument(this._shellElement)) return;
15415
+ const width = Math.round(this._shellElement.clientWidth);
15416
+ const height = Math.round(this._shellElement.clientHeight);
15417
+ if (width === 0 || height === 0) return;
15418
+ this.layout(width, height);
15419
+ }
15033
15420
  layout(width, height) {
15034
15421
  this._outerSplitview.layout(width, height);
15035
15422
  this._flushPendingSizes();
@@ -15289,6 +15676,15 @@ var ShellManager = class {
15289
15676
 
15290
15677
  //#endregion
15291
15678
  //#region src/dockview/dockviewComponent.ts
15679
+ /**
15680
+ * An error says the most about why, so it wins; a blocked window has none, and
15681
+ * its usual cause is more useful than its name.
15682
+ */
15683
+ function logFailedPopout(failure) {
15684
+ if (failure.error) console.error("dockview: failed to create popout.", failure.error);
15685
+ else if (failure.reason === "blocked") console.error("dockview: failed to create popout. perhaps you need to allow pop-ups for this website");
15686
+ else console.error(`dockview: failed to create popout (${failure.reason}).`);
15687
+ }
15292
15688
  function buildTabGroupColorPalette(options) {
15293
15689
  var _options$tabGroupColo;
15294
15690
  return new TabGroupColorPalette((_options$tabGroupColo = options.tabGroupColors) !== null && _options$tabGroupColo !== void 0 ? _options$tabGroupColo : DEFAULT_TAB_GROUP_COLORS, options.tabGroupAccent !== "off");
@@ -15340,6 +15736,10 @@ var DockviewComponent = class extends BaseGrid {
15340
15736
  get panels() {
15341
15737
  return this.groups.flatMap((group) => group.panels);
15342
15738
  }
15739
+ /** `dndStrategy` resolved against this device; see `DockviewApi`. */
15740
+ get dndCapabilities() {
15741
+ return resolveDndCapabilities(this.options);
15742
+ }
15343
15743
  get options() {
15344
15744
  return this._options;
15345
15745
  }
@@ -15849,9 +16249,9 @@ var DockviewComponent = class extends BaseGrid {
15849
16249
  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();
15850
16250
  }
15851
16251
  constructor(container, options) {
15852
- var _options$theme$gap, _options$theme, _options$theme$gap2, _options$theme2, _options$theme3;
16252
+ var _options$proportional, _options$theme$gap, _options$theme, _options$theme$gap2, _options$theme2, _options$theme3;
15853
16253
  super(container, {
15854
- proportionalLayout: true,
16254
+ proportionalLayout: (_options$proportional = options.proportionalLayout) !== null && _options$proportional !== void 0 ? _options$proportional : true,
15855
16255
  orientation: "HORIZONTAL",
15856
16256
  styles: options.hideBorders ? { separatorBorder: "transparent" } : void 0,
15857
16257
  disableAutoResizing: options.disableAutoResizing,
@@ -15898,6 +16298,8 @@ var DockviewComponent = class extends BaseGrid {
15898
16298
  this.onDidChangePopouts = this._onDidChangePopouts.event;
15899
16299
  this._onDidOpenPopoutWindowFail = new Emitter();
15900
16300
  this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
16301
+ this._onWillClosePopoutWindow = new Emitter();
16302
+ this.onWillClosePopoutWindow = this._onWillClosePopoutWindow.event;
15901
16303
  this._onDidStartFloatingGroupDrag = new Emitter();
15902
16304
  this.onDidStartFloatingGroupDrag = this._onDidStartFloatingGroupDrag.event;
15903
16305
  this._onDidEndFloatingGroupDrag = new Emitter();
@@ -15999,7 +16401,7 @@ var DockviewComponent = class extends BaseGrid {
15999
16401
  var _this$_shellManager2;
16000
16402
  this._moduleRegistry.dispose();
16001
16403
  (_this$_shellManager2 = this._shellManager) === null || _this$_shellManager2 === void 0 || _this$_shellManager2.dispose();
16002
- }));
16404
+ }), this._onWillClosePopoutWindow);
16003
16405
  const rootDropTarget = this._rootDropTargetService;
16004
16406
  if (rootDropTarget) this.addDisposables(rootDropTarget.onWillShowOverlay((event) => {
16005
16407
  if (this.gridview.length > 0 && event.position === "center") return;
@@ -16012,6 +16414,7 @@ var DockviewComponent = class extends BaseGrid {
16012
16414
  }));
16013
16415
  }), rootDropTarget.onDrop((event) => this.dockToLayoutEdge(event.nativeEvent, event.position)));
16014
16416
  this._moduleRegistry.postConstruct(this);
16417
+ this._shellManager.layoutFromElement();
16015
16418
  }
16016
16419
  setVisible(panel, visible) {
16017
16420
  switch (panel.api.location.type) {
@@ -16081,22 +16484,36 @@ var DockviewComponent = class extends BaseGrid {
16081
16484
  const box = getBox();
16082
16485
  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();
16083
16486
  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;
16487
+ const popoutUrl = resolvedPopoutUrl !== null && resolvedPopoutUrl !== void 0 ? resolvedPopoutUrl : "/popout.html";
16084
16488
  const _window = new PopoutWindow(`${this.id}-${groupId}`, theme !== null && theme !== void 0 ? theme : "", {
16085
- url: resolvedPopoutUrl !== null && resolvedPopoutUrl !== void 0 ? resolvedPopoutUrl : "/popout.html",
16489
+ url: popoutUrl,
16086
16490
  left: box.left,
16087
16491
  top: box.top,
16088
16492
  width: box.width,
16089
16493
  height: box.height,
16090
16494
  onDidOpen: options === null || options === void 0 ? void 0 : options.onDidOpen,
16091
- onWillClose: options === null || options === void 0 ? void 0 : options.onWillClose,
16092
- nonce: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.nonce
16495
+ onWillClose: (event) => {
16496
+ var _options$onWillClose;
16497
+ options === null || options === void 0 || (_options$onWillClose = options.onWillClose) === null || _options$onWillClose === void 0 || _options$onWillClose.call(options, event);
16498
+ this._onWillClosePopoutWindow.fire(event);
16499
+ },
16500
+ nonce: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.nonce,
16501
+ styleRoot: () => this.element.getRootNode()
16093
16502
  });
16094
16503
  const popoutWindowDisposable = new CompositeDisposable(_window, _window.onDidClose(() => {
16095
16504
  popoutWindowDisposable.dispose();
16096
16505
  }));
16097
- return _window.open().then((popoutContainer) => {
16506
+ const openError = getPopoutUrlError(popoutUrl);
16507
+ return (openError ? Promise.resolve(null) : _window.open()).then((popoutContainer) => {
16098
16508
  var _options$referenceGro, _options$overridePopo4;
16099
- if (_window.isDisposed) return false;
16509
+ if (_window.isDisposed) {
16510
+ const failure = _window.failure;
16511
+ if (failure && !this.isDisposed) {
16512
+ logFailedPopout(failure);
16513
+ this._onDidOpenPopoutWindowFail.fire(failure);
16514
+ }
16515
+ return false;
16516
+ }
16100
16517
  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;
16101
16518
  const referenceLocation = itemToPopout.api.location.type;
16102
16519
  /**
@@ -16115,11 +16532,16 @@ var DockviewComponent = class extends BaseGrid {
16115
16532
  if (popoutContainer) this._onDidAddGroup.fire(group);
16116
16533
  }
16117
16534
  if (popoutContainer === null) {
16535
+ var _window$failure;
16118
16536
  this.handleBlockedPopout({
16119
16537
  group,
16120
16538
  referenceGroup,
16121
16539
  options,
16122
- popoutWindowDisposable
16540
+ popoutWindowDisposable,
16541
+ failure: openError ? {
16542
+ reason: "url-refused",
16543
+ error: openError
16544
+ } : (_window$failure = _window.failure) !== null && _window$failure !== void 0 ? _window$failure : { reason: "blocked" }
16123
16545
  });
16124
16546
  return false;
16125
16547
  }
@@ -16282,16 +16704,17 @@ var DockviewComponent = class extends BaseGrid {
16282
16704
  });
16283
16705
  }
16284
16706
  /**
16285
- * The popout window was blocked (e.g. by the browser's popup blocker,
16286
- * common when restoring popouts on load). Fall back gracefully so the
16287
- * group(s) end up valid and visible in the main grid rather than as
16288
- * orphans that later crash clear()/remove().
16707
+ * The popout window never opened - blocked by the browser's popup blocker
16708
+ * (common when restoring popouts on load), or refused outright because its
16709
+ * URL failed the same-origin guard. Fall back gracefully so the group(s)
16710
+ * end up valid and visible in the main grid rather than as orphans that
16711
+ * render nothing and later crash clear()/remove().
16289
16712
  */
16290
16713
  handleBlockedPopout(params) {
16291
- const { group, referenceGroup, options, popoutWindowDisposable } = params;
16292
- console.error("dockview: failed to create popout. perhaps you need to allow pop-ups for this website");
16714
+ const { group, referenceGroup, options, popoutWindowDisposable, failure } = params;
16715
+ logFailedPopout(failure);
16293
16716
  popoutWindowDisposable.dispose();
16294
- this._onDidOpenPopoutWindowFail.fire();
16717
+ this._onDidOpenPopoutWindowFail.fire(failure);
16295
16718
  if (options === null || options === void 0 ? void 0 : options.overridePopoutGridview) {
16296
16719
  const blockedGridview = options.overridePopoutGridview;
16297
16720
  const members = this.groups.filter((candidate) => blockedGridview.element.contains(candidate.element));
@@ -16525,12 +16948,13 @@ var DockviewComponent = class extends BaseGrid {
16525
16948
  if (group.model.size === 0) this.doRemoveGroup(group, { skipActive: true });
16526
16949
  }
16527
16950
  /**
16528
- * Build an empty gridview configured to match the main grid's styling, for
16529
- * hosting a nested layout inside a floating or popout window.
16951
+ * Build an empty gridview configured to match the main grid's styling and
16952
+ * resize behaviour, for hosting a nested layout inside a floating or popout
16953
+ * window.
16530
16954
  */
16531
16955
  createNestedGridview(orientation = "HORIZONTAL") {
16532
16956
  var _this$options$theme$g, _this$options$theme2;
16533
- 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);
16957
+ 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);
16534
16958
  }
16535
16959
  /**
16536
16960
  * Wrap a (populated) floating gridview in an overlay window: title bar /
@@ -16603,6 +17027,12 @@ var DockviewComponent = class extends BaseGrid {
16603
17027
  const newDisableDnd = this.options.disableDnd;
16604
17028
  const newDndStrategy = this.options.dndStrategy;
16605
17029
  if (oldDisableDnd !== newDisableDnd || oldDndStrategy !== newDndStrategy) this.updateDragAndDropState();
17030
+ if ("proportionalLayout" in options) {
17031
+ var _this$_popoutWindowSe9, _this$_popoutWindowSe10;
17032
+ const proportionalLayout = this.gridview.proportionalLayout;
17033
+ for (const floating of this.floatingGroups) floating.gridview.proportionalLayout = proportionalLayout;
17034
+ 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;
17035
+ }
16606
17036
  if ("theme" in options) this.updateTheme();
16607
17037
  if ("createRightHeaderActionComponent" in options || "createLeftHeaderActionComponent" in options || "createPrefixHeaderActionComponent" in options) {
16608
17038
  var _this$headerActionsSe;
@@ -16910,14 +17340,14 @@ var DockviewComponent = class extends BaseGrid {
16910
17340
  * @returns A JSON respresentation of the layout
16911
17341
  */
16912
17342
  toJSON() {
16913
- var _this$_floatingGroupS3, _this$_floatingGroupS4, _this$_popoutWindowSe9, _this$_popoutWindowSe10, _this$activeGroup2;
17343
+ var _this$_floatingGroupS3, _this$_floatingGroupS4, _this$_popoutWindowSe11, _this$_popoutWindowSe12, _this$activeGroup2;
16914
17344
  const data = this.gridview.serialize();
16915
17345
  const panels = this.panels.reduce((collection, panel) => {
16916
17346
  collection[panel.id] = panel.toJSON();
16917
17347
  return collection;
16918
17348
  }, {});
16919
17349
  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 : [];
16920
- 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 : [];
17350
+ 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 : [];
16921
17351
  const result = {
16922
17352
  grid: data,
16923
17353
  panels,
@@ -16956,8 +17386,8 @@ var DockviewComponent = class extends BaseGrid {
16956
17386
  this.mutation("load", () => this._doFromJSON(data, options));
16957
17387
  }
16958
17388
  _doFromJSON(data, options) {
16959
- var _this$_popoutWindowSe11, _data$grid$root;
16960
- (_this$_popoutWindowSe11 = this._popoutWindowService) === null || _this$_popoutWindowSe11 === void 0 || _this$_popoutWindowSe11.cancelPendingRestorations();
17389
+ var _this$_popoutWindowSe13, _data$grid$root;
17390
+ (_this$_popoutWindowSe13 = this._popoutWindowService) === null || _this$_popoutWindowSe13 === void 0 || _this$_popoutWindowSe13.cancelPendingRestorations();
16961
17391
  if (typeof data !== "object" || data === null) throw new Error("dockview: serialized layout must be a non-null object");
16962
17392
  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");
16963
17393
  const existingPanels = /* @__PURE__ */ new Map();
@@ -17076,7 +17506,7 @@ var DockviewComponent = class extends BaseGrid {
17076
17506
  } else this.clear();
17077
17507
  const { grid, panels, activeGroup } = data;
17078
17508
  try {
17079
- var _data$floatingGroups, _data$popoutGroups, _this$_popoutWindowSe12, _this$_floatingGroupS5, _this$_watermarkServi2;
17509
+ var _data$floatingGroups, _data$popoutGroups, _this$_popoutWindowSe14, _this$_floatingGroupS5, _this$_watermarkServi2;
17080
17510
  const width = this.width;
17081
17511
  const height = this.height;
17082
17512
  const createGroupFromSerializedState = (data) => {
@@ -17141,7 +17571,7 @@ var DockviewComponent = class extends BaseGrid {
17141
17571
  if (data.edgeGroups) this.deserializeEdgeGroups(data.edgeGroups, panels, existingPanels, temporaryGroups);
17142
17572
  this.deserializeFloatingWindows((_data$floatingGroups = data.floatingGroups) !== null && _data$floatingGroups !== void 0 ? _data$floatingGroups : [], createGroupFromSerializedState);
17143
17573
  const popoutPromises = this.deserializePopoutWindows((_data$popoutGroups = data.popoutGroups) !== null && _data$popoutGroups !== void 0 ? _data$popoutGroups : [], createGroupFromSerializedState);
17144
- (_this$_popoutWindowSe12 = this._popoutWindowService) === null || _this$_popoutWindowSe12 === void 0 || _this$_popoutWindowSe12.finishRestoration(popoutPromises);
17574
+ (_this$_popoutWindowSe14 = this._popoutWindowService) === null || _this$_popoutWindowSe14 === void 0 || _this$_popoutWindowSe14.finishRestoration(popoutPromises);
17145
17575
  (_this$_floatingGroupS5 = this._floatingGroupService) === null || _this$_floatingGroupS5 === void 0 || _this$_floatingGroupS5.constrainBounds();
17146
17576
  if (typeof activeGroup === "string") {
17147
17577
  const panel = this.getPanel(activeGroup);
@@ -17309,15 +17739,13 @@ var DockviewComponent = class extends BaseGrid {
17309
17739
  }
17310
17740
  }
17311
17741
  const group = grid ? members[0] : createGroup(data);
17312
- return popoutService.scheduleRestoration(index * 100, () => {
17313
- this.addPopoutGroup(group, {
17314
- position: position !== null && position !== void 0 ? position : void 0,
17315
- overridePopoutGroup: gridReferenceGroup ? group : void 0,
17316
- overridePopoutGridview,
17317
- referenceGroup: gridReferenceGroup ? this.getPanel(gridReferenceGroup) : void 0,
17318
- popoutUrl: url
17319
- });
17320
- }, () => {
17742
+ return popoutService.scheduleRestoration(index * 100, () => this.addPopoutGroup(group, {
17743
+ position: position !== null && position !== void 0 ? position : void 0,
17744
+ overridePopoutGroup: gridReferenceGroup ? group : void 0,
17745
+ overridePopoutGridview,
17746
+ referenceGroup: gridReferenceGroup ? this.getPanel(gridReferenceGroup) : void 0,
17747
+ popoutUrl: url
17748
+ }), () => {
17321
17749
  for (const orphan of members.length > 0 ? members : [group]) if (!this.isDisposed && this._groups.has(orphan.id) && orphan.element.parentElement === null) {
17322
17750
  for (const panel of [...orphan.panels]) this.removePanel(panel, { removeEmptyGroup: false });
17323
17751
  orphan.dispose();
@@ -17552,7 +17980,7 @@ var DockviewComponent = class extends BaseGrid {
17552
17980
  * window.
17553
17981
  */
17554
17982
  detachFromNestedWindow(group) {
17555
- var _this$_floatingGroupS7, _this$_popoutWindowSe13;
17983
+ var _this$_floatingGroupS7, _this$_popoutWindowSe15;
17556
17984
  const floating = (_this$_floatingGroupS7 = this._floatingGroupService) === null || _this$_floatingGroupS7 === void 0 ? void 0 : _this$_floatingGroupS7.findByGroup(group);
17557
17985
  if (floating) {
17558
17986
  const members = this.nestedWindowMembers(group);
@@ -17561,7 +17989,7 @@ var DockviewComponent = class extends BaseGrid {
17561
17989
  if (floating.group === group) floating.setAnchorGroup(members.find((m) => m !== group));
17562
17990
  return true;
17563
17991
  }
17564
- const popout = (_this$_popoutWindowSe13 = this._popoutWindowService) === null || _this$_popoutWindowSe13 === void 0 ? void 0 : _this$_popoutWindowSe13.findByGroup(group);
17992
+ const popout = (_this$_popoutWindowSe15 = this._popoutWindowService) === null || _this$_popoutWindowSe15 === void 0 ? void 0 : _this$_popoutWindowSe15.findByGroup(group);
17565
17993
  if (popout) {
17566
17994
  const members = this.nestedWindowMembers(group);
17567
17995
  if (members.length <= 1) return false;
@@ -17618,8 +18046,8 @@ var DockviewComponent = class extends BaseGrid {
17618
18046
  return group;
17619
18047
  }
17620
18048
  if (group.api.location.type === "popout") {
17621
- var _this$_popoutWindowSe14, _this$_popoutWindowSe15;
17622
- const selectedGroup = (_this$_popoutWindowSe14 = this._popoutWindowService) === null || _this$_popoutWindowSe14 === void 0 ? void 0 : _this$_popoutWindowSe14.findByGroup(group);
18049
+ var _this$_popoutWindowSe16, _this$_popoutWindowSe17;
18050
+ const selectedGroup = (_this$_popoutWindowSe16 = this._popoutWindowService) === null || _this$_popoutWindowSe16 === void 0 ? void 0 : _this$_popoutWindowSe16.findByGroup(group);
17623
18051
  if (!selectedGroup) throw new Error("dockview: failed to find popout group");
17624
18052
  if (this.detachFromNestedWindow(group)) {
17625
18053
  if (options === null || options === void 0 ? void 0 : options.skipDispose) group.model.location = { type: "grid" };
@@ -17636,7 +18064,7 @@ var DockviewComponent = class extends BaseGrid {
17636
18064
  this._groups.delete(group.id);
17637
18065
  this._onDidRemoveGroup.fire(group);
17638
18066
  }
17639
- (_this$_popoutWindowSe15 = this._popoutWindowService) === null || _this$_popoutWindowSe15 === void 0 || _this$_popoutWindowSe15.remove(selectedGroup);
18067
+ (_this$_popoutWindowSe17 = this._popoutWindowService) === null || _this$_popoutWindowSe17 === void 0 || _this$_popoutWindowSe17.remove(selectedGroup);
17640
18068
  const removedGroup = selectedGroup.disposable.dispose();
17641
18069
  if (!(options === null || options === void 0 ? void 0 : options.skipPopoutReturn) && removedGroup) {
17642
18070
  this.doAddGroup(removedGroup, [0]);
@@ -17663,10 +18091,10 @@ var DockviewComponent = class extends BaseGrid {
17663
18091
  debouncedUpdateAllPositions() {
17664
18092
  if (this._updatePositionsFrameId !== void 0) cancelAnimationFrame(this._updatePositionsFrameId);
17665
18093
  this._updatePositionsFrameId = requestAnimationFrame(() => {
17666
- var _this$_popoutWindowSe16, _this$_popoutWindowSe17;
18094
+ var _this$_popoutWindowSe18, _this$_popoutWindowSe19;
17667
18095
  this._updatePositionsFrameId = void 0;
17668
18096
  this.overlayRenderContainer.updateAllPositions();
17669
- 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();
18097
+ 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();
17670
18098
  });
17671
18099
  }
17672
18100
  movingLock(func) {
@@ -17916,7 +18344,7 @@ var DockviewComponent = class extends BaseGrid {
17916
18344
  }
17917
18345
  }
17918
18346
  if (sourceGroup.api.location.type === "popout" && this.nestedWindowMembers(sourceGroup).length <= 1) {
17919
- var _this$_popoutWindowSe18;
18347
+ var _this$_popoutWindowSe20;
17920
18348
  /**
17921
18349
  * the source group is the only group in a popout window and
17922
18350
  * has a single panel
@@ -17931,7 +18359,7 @@ var DockviewComponent = class extends BaseGrid {
17931
18359
  * Multi-group popout windows fall through to the generic
17932
18360
  * detach-and-re-add path so the window stays alive.
17933
18361
  */
17934
- const popoutGroup = (_this$_popoutWindowSe18 = this._popoutWindowService) === null || _this$_popoutWindowSe18 === void 0 ? void 0 : _this$_popoutWindowSe18.findByGroup(sourceGroup);
18362
+ const popoutGroup = (_this$_popoutWindowSe20 = this._popoutWindowService) === null || _this$_popoutWindowSe20 === void 0 ? void 0 : _this$_popoutWindowSe20.findByGroup(sourceGroup);
17935
18363
  if (!popoutGroup) return;
17936
18364
  const removedPanel = this.movingLock(() => popoutGroup.popoutGroup.model.removePanel(popoutGroup.popoutGroup.panels[0], {
17937
18365
  skipSetActive: true,
@@ -18140,11 +18568,11 @@ var DockviewComponent = class extends BaseGrid {
18140
18568
  break;
18141
18569
  }
18142
18570
  case "popout": {
18143
- var _this$_popoutWindowSe19, _this$_popoutWindowSe20;
18144
- const selectedPopoutGroup = (_this$_popoutWindowSe19 = this._popoutWindowService) === null || _this$_popoutWindowSe19 === void 0 ? void 0 : _this$_popoutWindowSe19.findByGroup(from);
18571
+ var _this$_popoutWindowSe21, _this$_popoutWindowSe22;
18572
+ const selectedPopoutGroup = (_this$_popoutWindowSe21 = this._popoutWindowService) === null || _this$_popoutWindowSe21 === void 0 ? void 0 : _this$_popoutWindowSe21.findByGroup(from);
18145
18573
  if (!selectedPopoutGroup) throw new Error("dockview: failed to find popout group");
18146
18574
  if (this.detachFromNestedWindow(from)) break;
18147
- (_this$_popoutWindowSe20 = this._popoutWindowService) === null || _this$_popoutWindowSe20 === void 0 || _this$_popoutWindowSe20.remove(selectedPopoutGroup);
18575
+ (_this$_popoutWindowSe22 = this._popoutWindowService) === null || _this$_popoutWindowSe22 === void 0 || _this$_popoutWindowSe22.remove(selectedPopoutGroup);
18148
18576
  if (selectedPopoutGroup.referenceGroup) {
18149
18577
  const referenceGroup = this.getPanel(selectedPopoutGroup.referenceGroup);
18150
18578
  if (referenceGroup && !referenceGroup.api.isVisible) this.doRemoveGroup(referenceGroup, { skipActive: true });
@@ -18309,8 +18737,8 @@ var DockviewComponent = class extends BaseGrid {
18309
18737
  * window-local containers).
18310
18738
  */
18311
18739
  setGroupLocationForRoot(group, gridview) {
18312
- var _this$_popoutWindowSe21;
18313
- const popout = (_this$_popoutWindowSe21 = this._popoutWindowService) === null || _this$_popoutWindowSe21 === void 0 ? void 0 : _this$_popoutWindowSe21.entries.find((entry) => entry.gridview === gridview);
18740
+ var _this$_popoutWindowSe23;
18741
+ const popout = (_this$_popoutWindowSe23 = this._popoutWindowService) === null || _this$_popoutWindowSe23 === void 0 ? void 0 : _this$_popoutWindowSe23.entries.find((entry) => entry.gridview === gridview);
18314
18742
  if (popout) {
18315
18743
  if (group.model.renderContainer !== popout.overlayRenderContainer) group.model.renderContainer = popout.overlayRenderContainer;
18316
18744
  group.model.dropTargetContainer = popout.dropTargetContainer;
@@ -18330,10 +18758,10 @@ var DockviewComponent = class extends BaseGrid {
18330
18758
  * the nested gridview of the floating / popout window it lives in.
18331
18759
  */
18332
18760
  getGridviewForGroup(group) {
18333
- var _this$_floatingGroupS10, _this$_popoutWindowSe22;
18761
+ var _this$_floatingGroupS10, _this$_popoutWindowSe24;
18334
18762
  const floating = (_this$_floatingGroupS10 = this._floatingGroupService) === null || _this$_floatingGroupS10 === void 0 ? void 0 : _this$_floatingGroupS10.findByGroup(group);
18335
18763
  if (floating) return floating.gridview;
18336
- const popout = (_this$_popoutWindowSe22 = this._popoutWindowService) === null || _this$_popoutWindowSe22 === void 0 ? void 0 : _this$_popoutWindowSe22.findByGroup(group);
18764
+ const popout = (_this$_popoutWindowSe24 = this._popoutWindowService) === null || _this$_popoutWindowSe24 === void 0 ? void 0 : _this$_popoutWindowSe24.findByGroup(group);
18337
18765
  if (popout) return popout.gridview;
18338
18766
  return this.gridview;
18339
18767
  }
@@ -18355,13 +18783,13 @@ var DockviewComponent = class extends BaseGrid {
18355
18783
  return location.length % 2 == 1 ? rootOrientation : orthogonal(rootOrientation);
18356
18784
  }
18357
18785
  updateTheme() {
18358
- var _this$_options$theme, _this$_shellThemeClas, _theme$gap, _this$_popoutWindowSe23, _this$_popoutWindowSe24, _this$_shellManager5, _theme$edgeGroupColla, _theme$tabGroupIndica;
18786
+ var _this$_options$theme, _this$_shellThemeClas, _theme$gap, _this$_popoutWindowSe25, _this$_popoutWindowSe26, _this$_shellManager5, _theme$edgeGroupColla, _theme$tabGroupIndica;
18359
18787
  const theme = (_this$_options$theme = this._options.theme) !== null && _this$_options$theme !== void 0 ? _this$_options$theme : themeAbyss;
18360
18788
  (_this$_shellThemeClas = this._shellThemeClassnames) === null || _this$_shellThemeClas === void 0 || _this$_shellThemeClas.setClassNames(theme.className);
18361
18789
  const gap = (_theme$gap = theme.gap) !== null && _theme$gap !== void 0 ? _theme$gap : 0;
18362
18790
  this.gridview.margin = gap;
18363
18791
  for (const floating of this.floatingGroups) floating.gridview.margin = gap;
18364
- 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;
18792
+ 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;
18365
18793
  (_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);
18366
18794
  if (theme.dndOverlayBorder === void 0) {
18367
18795
  var _this$_shellManager6;
@@ -18430,6 +18858,7 @@ var GridviewComponent = class extends BaseGrid {
18430
18858
  }), this.onDidActiveChange((event) => {
18431
18859
  this._onDidActiveGroupChange.fire(event);
18432
18860
  }));
18861
+ this.layoutFromElement();
18433
18862
  }
18434
18863
  updateOptions(options) {
18435
18864
  super.updateOptions(options);
@@ -18675,6 +19104,7 @@ var SplitviewComponent = class extends Resizable {
18675
19104
  this._options = options;
18676
19105
  this.splitview = new Splitview(this.element, options);
18677
19106
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
19107
+ this.layoutFromElement();
18678
19108
  }
18679
19109
  updateOptions(options) {
18680
19110
  if ("className" in options) {
@@ -19356,11 +19786,13 @@ exports.createSplitview = createSplitview;
19356
19786
  exports.defineModule = defineModule;
19357
19787
  exports.directionToPosition = directionToPosition;
19358
19788
  exports.findRelativeZIndexParent = findRelativeZIndexParent;
19789
+ exports.getActiveElement = getActiveElement;
19359
19790
  exports.getDirectionOrientation = getDirectionOrientation;
19360
19791
  exports.getGridLocation = getGridLocation;
19361
19792
  exports.getLocationOrientation = getLocationOrientation;
19362
19793
  exports.getPaneData = getPaneData;
19363
19794
  exports.getPanelData = getPanelData;
19795
+ exports.getPopoutUrlError = getPopoutUrlError;
19364
19796
  exports.getRegisteredModules = getRegisteredModules;
19365
19797
  exports.getRelativeLocation = getRelativeLocation;
19366
19798
  exports.indexInParent = indexInParent;