dockview-core 8.2.0 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/dockviewGroupPanelApi.d.ts +7 -0
- package/dist/cjs/dnd/dropTargetAnchorContainer.d.ts +6 -0
- package/dist/cjs/dockview/components/titlebar/tabReorderController.d.ts +8 -0
- package/dist/cjs/dockview/contextMenuService.d.ts +62 -0
- package/dist/cjs/dockview/dockviewComponent.d.ts +8 -0
- package/dist/cjs/dockview/dockviewShell.d.ts +15 -0
- package/dist/cjs/dockview/modules.d.ts +2 -2
- package/dist/cjs/dockview/optionsModules.d.ts +3 -4
- package/dist/cjs/gridview/baseComponentGridview.d.ts +2 -2
- package/dist/cjs/index.d.ts +1 -0
- package/dist/dockview-core.js +441 -84
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.noStyle.js +441 -84
- package/dist/package/main.cjs.js +441 -84
- package/dist/package/main.cjs.min.js +2 -2
- package/dist/package/main.esm.min.mjs +2 -2
- package/dist/package/main.esm.mjs +440 -85
- package/package.json +1 -1
package/dist/dockview-core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 8.
|
|
3
|
+
* @version 8.3.0
|
|
4
4
|
* @link https://github.com/dockview/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -1063,8 +1063,14 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
1063
1063
|
container.appendChild(view.element);
|
|
1064
1064
|
let viewSize;
|
|
1065
1065
|
if (typeof size === "number") viewSize = size;
|
|
1066
|
-
else if (size.type === "split")
|
|
1067
|
-
|
|
1066
|
+
else if (size.type === "split") {
|
|
1067
|
+
const splitTarget = this.viewItems[size.index];
|
|
1068
|
+
if (splitTarget) {
|
|
1069
|
+
const half = Math.floor(splitTarget.size / 2);
|
|
1070
|
+
viewSize = splitTarget.size - half;
|
|
1071
|
+
splitTarget.size = half;
|
|
1072
|
+
} else viewSize = this.getViewSize(size.index) / 2;
|
|
1073
|
+
} else if (size.type === "invisible") viewSize = { cachedVisibleSize: size.cachedVisibleSize };
|
|
1068
1074
|
else viewSize = view.minimumSize;
|
|
1069
1075
|
const disposable = view.onDidChange((newSize) => this.onDidChange(viewItem, newSize.size));
|
|
1070
1076
|
const viewItem = new ViewItem(container, view, viewSize, { dispose: () => {
|
|
@@ -5809,7 +5815,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
5809
5815
|
};
|
|
5810
5816
|
case "auto":
|
|
5811
5817
|
case void 0:
|
|
5812
|
-
default: return isCoarsePrimaryInput$
|
|
5818
|
+
default: return isCoarsePrimaryInput$2() ? {
|
|
5813
5819
|
html5: false,
|
|
5814
5820
|
pointer: true,
|
|
5815
5821
|
pointerHandlesMouse: true
|
|
@@ -5820,7 +5826,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
5820
5826
|
};
|
|
5821
5827
|
}
|
|
5822
5828
|
}
|
|
5823
|
-
function isCoarsePrimaryInput$
|
|
5829
|
+
function isCoarsePrimaryInput$2() {
|
|
5824
5830
|
if (globalThis.window === void 0 || !globalThis.matchMedia) return false;
|
|
5825
5831
|
const coarse = globalThis.matchMedia("(pointer: coarse)").matches;
|
|
5826
5832
|
const fine = globalThis.matchMedia("(pointer: fine)").matches;
|
|
@@ -7975,11 +7981,28 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
7975
7981
|
if (this._voidContainer && related && (related === this._voidContainer || this._voidContainer.contains(related))) return;
|
|
7976
7982
|
this.resetTabTransforms();
|
|
7977
7983
|
if (this._animState.sourceIndex === -1) {
|
|
7978
|
-
|
|
7979
|
-
(_this$group$model$dro2 = this.group.model.dropTargetContainer) === null || _this$group$model$dro2 === void 0 || (_this$group$model$dro2 = _this$group$model$dro2.model) === null || _this$group$model$dro2 === void 0 || _this$group$model$dro2.clear();
|
|
7984
|
+
this.clearHeaderAnchorOverlay();
|
|
7980
7985
|
this._animState = null;
|
|
7981
7986
|
} else this._animState.currentInsertionIndex = null;
|
|
7982
7987
|
}
|
|
7988
|
+
/**
|
|
7989
|
+
* Clear the anchored overlay only when this header is what rendered it.
|
|
7990
|
+
* The container is shared with the group's content drop target, which
|
|
7991
|
+
* renders into it on the same frame the cursor leaves the strip: the
|
|
7992
|
+
* pointer backend calls `handleDragOver` on the new target before the
|
|
7993
|
+
* global `onDragMove` that reaches us (#1612).
|
|
7994
|
+
*/
|
|
7995
|
+
clearHeaderAnchorOverlay() {
|
|
7996
|
+
var _container$model;
|
|
7997
|
+
const container = this.group.model.dropTargetContainer;
|
|
7998
|
+
const outline = container === null || container === void 0 ? void 0 : container.renderedOutline;
|
|
7999
|
+
if (outline && ![
|
|
8000
|
+
this._tabsList,
|
|
8001
|
+
this._voidContainer,
|
|
8002
|
+
this._extendedDropZone
|
|
8003
|
+
].some((scope) => scope === null || scope === void 0 ? void 0 : scope.contains(outline))) return;
|
|
8004
|
+
container === null || container === void 0 || (_container$model = container.model) === null || _container$model === void 0 || _container$model.clear();
|
|
8005
|
+
}
|
|
7983
8006
|
handleDragOver(event) {
|
|
7984
8007
|
var _this$accessor$option2;
|
|
7985
8008
|
if (!this._animState) return;
|
|
@@ -12409,7 +12432,6 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
12409
12432
|
"AdvancedOverflow",
|
|
12410
12433
|
"AutoEdgeGroup",
|
|
12411
12434
|
"AutoHideEdgeGroup",
|
|
12412
|
-
"ContextMenu",
|
|
12413
12435
|
"DndCompass",
|
|
12414
12436
|
"KeyboardDocking",
|
|
12415
12437
|
"KeyboardNavigation",
|
|
@@ -12491,8 +12513,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
12491
12513
|
* case: calling `undo()` having never set the option at all.
|
|
12492
12514
|
*
|
|
12493
12515
|
* Interaction handlers are queries in this sense too: a right-click reaching an
|
|
12494
|
-
* absent
|
|
12495
|
-
*
|
|
12516
|
+
* absent module means the app never asked for that feature, so it stays silent
|
|
12517
|
+
* (`?.`) and the browser's own behaviour applies. Options are where intent is
|
|
12496
12518
|
* declared; see `optionsModules.ts`.
|
|
12497
12519
|
*/
|
|
12498
12520
|
function assertModule(service, moduleName, context) {
|
|
@@ -12572,10 +12594,9 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
12572
12594
|
*
|
|
12573
12595
|
* This is the "declared intent" diagnostic. It fires when the user asks for a
|
|
12574
12596
|
* feature via options, at construction and on every `updateOptions`. It
|
|
12575
|
-
* deliberately does *not* fire on user interaction:
|
|
12576
|
-
*
|
|
12577
|
-
*
|
|
12578
|
-
* app never wanted.
|
|
12597
|
+
* deliberately does *not* fire on user interaction: an interaction reaching an
|
|
12598
|
+
* absent module stays silent, because the `?.` service-slot call sites can't
|
|
12599
|
+
* tell a missing module from a feature the app never wanted.
|
|
12579
12600
|
*
|
|
12580
12601
|
* Rules are a flat list rather than a `Record<keyof DockviewOptions, ...>`
|
|
12581
12602
|
* because dockview's options are nested and value-gated: `overflow.mode:
|
|
@@ -12671,18 +12692,6 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
12671
12692
|
moduleName: "AutoEdgeGroup",
|
|
12672
12693
|
when: (o) => isAnyEdgeGroupEnabled(o.dockToEdgeGroups)
|
|
12673
12694
|
},
|
|
12674
|
-
{
|
|
12675
|
-
optionKey: "getTabContextMenuItems",
|
|
12676
|
-
reason: "getTabContextMenuItems",
|
|
12677
|
-
moduleName: "ContextMenu",
|
|
12678
|
-
when: (o) => o.getTabContextMenuItems != null
|
|
12679
|
-
},
|
|
12680
|
-
{
|
|
12681
|
-
optionKey: "getTabGroupChipContextMenuItems",
|
|
12682
|
-
reason: "getTabGroupChipContextMenuItems",
|
|
12683
|
-
moduleName: "ContextMenu",
|
|
12684
|
-
when: (o) => o.getTabGroupChipContextMenuItems != null
|
|
12685
|
-
},
|
|
12686
12695
|
{
|
|
12687
12696
|
optionKey: "dndCompass",
|
|
12688
12697
|
reason: "dndCompass",
|
|
@@ -13583,6 +13592,270 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
13583
13592
|
}
|
|
13584
13593
|
});
|
|
13585
13594
|
|
|
13595
|
+
//#endregion
|
|
13596
|
+
//#region src/dockview/contextMenuService.ts
|
|
13597
|
+
function popoverZIndexFor(target, group) {
|
|
13598
|
+
var _group$api, _group$api$isPeeking;
|
|
13599
|
+
if ((_group$api = group.api) === null || _group$api === void 0 || (_group$api$isPeeking = _group$api.isPeeking) === null || _group$api$isPeeking === void 0 ? void 0 : _group$api$isPeeking.call(_group$api)) return "calc(var(--dv-overlay-z-index, 999) + 100)";
|
|
13600
|
+
if (!(target instanceof HTMLElement)) return;
|
|
13601
|
+
const relativeParent = findRelativeZIndexParent(target);
|
|
13602
|
+
return (relativeParent === null || relativeParent === void 0 ? void 0 : relativeParent.style.zIndex) ? `calc(${relativeParent.style.zIndex} * 2)` : void 0;
|
|
13603
|
+
}
|
|
13604
|
+
let _nextId = 0;
|
|
13605
|
+
const nextContextMenuItemId = () => `dv-ctx-menu-item-${_nextId++}`;
|
|
13606
|
+
function isItemConfig(item) {
|
|
13607
|
+
return typeof item === "object";
|
|
13608
|
+
}
|
|
13609
|
+
function buildItem(label, close, action, disabled) {
|
|
13610
|
+
const el = document.createElement("div");
|
|
13611
|
+
el.className = "dv-context-menu-item";
|
|
13612
|
+
el.setAttribute("role", "menuitem");
|
|
13613
|
+
if (disabled) {
|
|
13614
|
+
el.classList.add("dv-context-menu-item--disabled");
|
|
13615
|
+
el.setAttribute("aria-disabled", "true");
|
|
13616
|
+
}
|
|
13617
|
+
el.textContent = label;
|
|
13618
|
+
if (!disabled) el.addEventListener("click", () => {
|
|
13619
|
+
action();
|
|
13620
|
+
close();
|
|
13621
|
+
});
|
|
13622
|
+
return el;
|
|
13623
|
+
}
|
|
13624
|
+
function buildSeparator() {
|
|
13625
|
+
const el = document.createElement("div");
|
|
13626
|
+
el.className = "dv-context-menu-separator";
|
|
13627
|
+
el.setAttribute("role", "separator");
|
|
13628
|
+
return el;
|
|
13629
|
+
}
|
|
13630
|
+
function isCoarsePrimaryInput$1() {
|
|
13631
|
+
if (globalThis.window === void 0 || !globalThis.matchMedia) return false;
|
|
13632
|
+
const coarse = globalThis.matchMedia("(pointer: coarse)").matches;
|
|
13633
|
+
const fine = globalThis.matchMedia("(pointer: fine)").matches;
|
|
13634
|
+
return coarse && !fine;
|
|
13635
|
+
}
|
|
13636
|
+
function buildRenameInput(tabGroup) {
|
|
13637
|
+
const wrapper = document.createElement("div");
|
|
13638
|
+
wrapper.className = "dv-context-menu-rename";
|
|
13639
|
+
const input = document.createElement("input");
|
|
13640
|
+
input.className = "dv-context-menu-rename-input";
|
|
13641
|
+
input.type = "text";
|
|
13642
|
+
input.placeholder = "Name This Group";
|
|
13643
|
+
input.value = tabGroup.label;
|
|
13644
|
+
input.addEventListener("input", () => {
|
|
13645
|
+
tabGroup.setLabel(input.value);
|
|
13646
|
+
});
|
|
13647
|
+
input.addEventListener("keydown", (e) => {
|
|
13648
|
+
if (e.key !== "Escape" && e.key !== "Enter") e.stopPropagation();
|
|
13649
|
+
});
|
|
13650
|
+
input.addEventListener("click", (e) => {
|
|
13651
|
+
e.stopPropagation();
|
|
13652
|
+
});
|
|
13653
|
+
wrapper.appendChild(input);
|
|
13654
|
+
if (!isCoarsePrimaryInput$1()) requestAnimationFrame(() => {
|
|
13655
|
+
input.focus();
|
|
13656
|
+
input.select();
|
|
13657
|
+
});
|
|
13658
|
+
return wrapper;
|
|
13659
|
+
}
|
|
13660
|
+
function buildColorPicker(tabGroup, palette) {
|
|
13661
|
+
const wrapper = document.createElement("div");
|
|
13662
|
+
wrapper.className = "dv-context-menu-color-picker";
|
|
13663
|
+
if (!palette.enabled) return wrapper;
|
|
13664
|
+
for (const entry of palette.entries()) {
|
|
13665
|
+
const swatch = document.createElement("div");
|
|
13666
|
+
swatch.className = "dv-context-menu-color-swatch";
|
|
13667
|
+
swatch.style.setProperty("--dv-tab-group-color", entry.value);
|
|
13668
|
+
if (entry.label) swatch.title = entry.label;
|
|
13669
|
+
if (tabGroup.color === entry.id) swatch.classList.add("dv-context-menu-color-swatch--selected");
|
|
13670
|
+
swatch.addEventListener("click", () => {
|
|
13671
|
+
tabGroup.setColor(entry.id);
|
|
13672
|
+
});
|
|
13673
|
+
wrapper.appendChild(swatch);
|
|
13674
|
+
}
|
|
13675
|
+
return wrapper;
|
|
13676
|
+
}
|
|
13677
|
+
var ContextMenuController = class {
|
|
13678
|
+
constructor(accessor) {
|
|
13679
|
+
this.accessor = accessor;
|
|
13680
|
+
}
|
|
13681
|
+
/**
|
|
13682
|
+
* A single maximize/restore toggle whose label and behaviour track the
|
|
13683
|
+
* group's live state: it reads *Restore* + calls `exitMaximized` when the
|
|
13684
|
+
* group is maximized, otherwise *Maximize* + `maximize`. Only grid groups
|
|
13685
|
+
* can be maximized, so the item is disabled for floating / popout panels
|
|
13686
|
+
* that are not already maximized.
|
|
13687
|
+
*/
|
|
13688
|
+
buildMaximizeItem(panel, close) {
|
|
13689
|
+
const isMaximized = panel.api.isMaximized();
|
|
13690
|
+
return buildItem(isMaximized ? "Restore" : "Maximize", close, isMaximized ? () => panel.api.exitMaximized() : () => panel.api.maximize(), !isMaximized && panel.api.location.type !== "grid");
|
|
13691
|
+
}
|
|
13692
|
+
/**
|
|
13693
|
+
* A single collapse/expand toggle whose label tracks the tab group's live
|
|
13694
|
+
* state: *Expand* when the group is already collapsed, otherwise *Collapse*.
|
|
13695
|
+
*/
|
|
13696
|
+
buildCollapseItem(tabGroup, close) {
|
|
13697
|
+
return buildItem(tabGroup.collapsed ? "Expand" : "Collapse", close, () => tabGroup.toggle());
|
|
13698
|
+
}
|
|
13699
|
+
/**
|
|
13700
|
+
* Whether to auto-inject the built-in Pin/Unpin item at the top of the tab
|
|
13701
|
+
* menu. True only when the PinnedTabs module is registered, pinning is
|
|
13702
|
+
* enabled, and the app has not opted out via `pinnedTabs.contextMenuItem:
|
|
13703
|
+
* false` (the item is on by default). This keeps pinning reachable from the
|
|
13704
|
+
* menu without the app having to return `'pin'` from
|
|
13705
|
+
* `getTabContextMenuItems` itself.
|
|
13706
|
+
*/
|
|
13707
|
+
_shouldInjectPin() {
|
|
13708
|
+
const pinnedTabs = this.accessor.options.pinnedTabs;
|
|
13709
|
+
return !!this.accessor.pinnedTabsService && !!(pinnedTabs === null || pinnedTabs === void 0 ? void 0 : pinnedTabs.enabled) && pinnedTabs.contextMenuItem !== false;
|
|
13710
|
+
}
|
|
13711
|
+
/**
|
|
13712
|
+
* The tab menu items: the app's own items (if any) with the built-in
|
|
13713
|
+
* `'pin'` item prepended when {@link _shouldInjectPin} applies, so the app
|
|
13714
|
+
* keeps full control of its list, and pinning is added without disturbing
|
|
13715
|
+
* it. Reuses the existing `'pin'` token rendering below.
|
|
13716
|
+
*/
|
|
13717
|
+
_resolveTabItems(panel, group, event) {
|
|
13718
|
+
var _this$accessor$option, _this$accessor$option2, _this$accessor$option3;
|
|
13719
|
+
const appItems = (_this$accessor$option = (_this$accessor$option2 = (_this$accessor$option3 = this.accessor.options).getTabContextMenuItems) === null || _this$accessor$option2 === void 0 ? void 0 : _this$accessor$option2.call(_this$accessor$option3, {
|
|
13720
|
+
panel,
|
|
13721
|
+
group,
|
|
13722
|
+
api: this.accessor.api,
|
|
13723
|
+
event
|
|
13724
|
+
})) !== null && _this$accessor$option !== void 0 ? _this$accessor$option : [];
|
|
13725
|
+
return this._shouldInjectPin() ? ["pin", ...appItems] : appItems;
|
|
13726
|
+
}
|
|
13727
|
+
/**
|
|
13728
|
+
* Render a custom `component` menu item and append it to `menuEl`. Builds
|
|
13729
|
+
* the framework renderer via the host's `createContextMenuItemComponent`
|
|
13730
|
+
* factory and initialises it. Shared by the tab menu and the chip menu,
|
|
13731
|
+
* which differ only in `identity`: the tab menu passes the `panel`, the chip
|
|
13732
|
+
* menu passes the `tabGroup`. No-op when no renderer could be created (no
|
|
13733
|
+
* factory configured, or the factory declined the component).
|
|
13734
|
+
*/
|
|
13735
|
+
appendComponentItem(menuEl, item, identity, group, close) {
|
|
13736
|
+
var _this$accessor$option4, _this$accessor$option5;
|
|
13737
|
+
const renderer = (_this$accessor$option4 = (_this$accessor$option5 = this.accessor.options).createContextMenuItemComponent) === null || _this$accessor$option4 === void 0 ? void 0 : _this$accessor$option4.call(_this$accessor$option5, {
|
|
13738
|
+
id: nextContextMenuItemId(),
|
|
13739
|
+
component: item.component
|
|
13740
|
+
});
|
|
13741
|
+
if (!renderer) return;
|
|
13742
|
+
renderer.init(_objectSpread2(_objectSpread2({}, identity), {}, {
|
|
13743
|
+
group,
|
|
13744
|
+
api: this.accessor.api,
|
|
13745
|
+
close,
|
|
13746
|
+
componentProps: item.componentProps
|
|
13747
|
+
}));
|
|
13748
|
+
menuEl.appendChild(renderer.element);
|
|
13749
|
+
}
|
|
13750
|
+
/**
|
|
13751
|
+
* The element for one built-in tab item, or `undefined` for a token this
|
|
13752
|
+
* version doesn't know (an app on a newer typings version, or plain JS):
|
|
13753
|
+
* an unrecognised token renders nothing rather than throwing.
|
|
13754
|
+
*/
|
|
13755
|
+
buildBuiltInTabItem(item, panel, group, close) {
|
|
13756
|
+
switch (item) {
|
|
13757
|
+
case "separator": return buildSeparator();
|
|
13758
|
+
case "close": return buildItem("Close", close, () => panel.api.close());
|
|
13759
|
+
case "closeOthers": return buildItem("Close Others", close, () => {
|
|
13760
|
+
group.panels.filter((p) => p !== panel).forEach((p) => p.api.close());
|
|
13761
|
+
});
|
|
13762
|
+
case "closeAll": return buildItem("Close All", close, () => {
|
|
13763
|
+
[...group.panels].forEach((p) => p.api.close());
|
|
13764
|
+
});
|
|
13765
|
+
case "closeLeft": {
|
|
13766
|
+
const index = group.panels.indexOf(panel);
|
|
13767
|
+
return buildItem("Close to the Left", close, () => {
|
|
13768
|
+
group.panels.filter((_, i) => i < index).forEach((p) => p.api.close());
|
|
13769
|
+
}, index <= 0);
|
|
13770
|
+
}
|
|
13771
|
+
case "closeRight": {
|
|
13772
|
+
const index = group.panels.indexOf(panel);
|
|
13773
|
+
return buildItem("Close to the Right", close, () => {
|
|
13774
|
+
group.panels.filter((_, i) => i > index).forEach((p) => p.api.close());
|
|
13775
|
+
}, index === -1 || index >= group.panels.length - 1);
|
|
13776
|
+
}
|
|
13777
|
+
case "maximize": return this.buildMaximizeItem(panel, close);
|
|
13778
|
+
case "float": return buildItem("Float", close, () => this.accessor.api.addFloatingGroup(panel), panel.api.location.type === "floating");
|
|
13779
|
+
case "popout": return buildItem("Open in New Window", close, () => {
|
|
13780
|
+
this.accessor.api.addPopoutGroup(panel);
|
|
13781
|
+
}, panel.api.location.type === "popout");
|
|
13782
|
+
case "pin": return buildItem(panel.api.isPinned ? "Unpin tab" : "Pin tab", close, () => panel.api.setPinned(!panel.api.isPinned));
|
|
13783
|
+
default: return;
|
|
13784
|
+
}
|
|
13785
|
+
}
|
|
13786
|
+
/**
|
|
13787
|
+
* Append one app-supplied item. A raw `element` is used as-is, a
|
|
13788
|
+
* `component` goes through the framework renderer, and a `label` builds the
|
|
13789
|
+
* default row; an item carrying none of the three renders nothing. Shared
|
|
13790
|
+
* by both menus, which differ only in `identity`.
|
|
13791
|
+
*/
|
|
13792
|
+
appendConfigItem(menuEl, item, identity, group, close) {
|
|
13793
|
+
if (item.element) menuEl.appendChild(item.element);
|
|
13794
|
+
else if (item.component) this.appendComponentItem(menuEl, item, identity, group, close);
|
|
13795
|
+
else if (item.label) menuEl.appendChild(buildItem(item.label, close, () => {
|
|
13796
|
+
var _item$action;
|
|
13797
|
+
return (_item$action = item.action) === null || _item$action === void 0 ? void 0 : _item$action.call(item);
|
|
13798
|
+
}, item.disabled));
|
|
13799
|
+
}
|
|
13800
|
+
show(panel, group, event) {
|
|
13801
|
+
const items = this._resolveTabItems(panel, group, event);
|
|
13802
|
+
if (items.length === 0) return;
|
|
13803
|
+
event.preventDefault();
|
|
13804
|
+
const popupService = this.accessor.getPopupServiceForGroup(group);
|
|
13805
|
+
const close = () => popupService.close();
|
|
13806
|
+
const menuEl = document.createElement("div");
|
|
13807
|
+
menuEl.className = "dv-context-menu";
|
|
13808
|
+
menuEl.setAttribute("role", "menu");
|
|
13809
|
+
for (const item of items) {
|
|
13810
|
+
if (isItemConfig(item)) {
|
|
13811
|
+
this.appendConfigItem(menuEl, item, { panel }, group, close);
|
|
13812
|
+
continue;
|
|
13813
|
+
}
|
|
13814
|
+
const el = this.buildBuiltInTabItem(item, panel, group, close);
|
|
13815
|
+
if (el) menuEl.appendChild(el);
|
|
13816
|
+
}
|
|
13817
|
+
popupService.openPopover(menuEl, {
|
|
13818
|
+
x: event.clientX,
|
|
13819
|
+
y: event.clientY,
|
|
13820
|
+
zIndex: popoverZIndexFor(event.target, group)
|
|
13821
|
+
});
|
|
13822
|
+
}
|
|
13823
|
+
showForChip(tabGroup, group, event) {
|
|
13824
|
+
if (!this.accessor.options.getTabGroupChipContextMenuItems) return;
|
|
13825
|
+
const items = this.accessor.options.getTabGroupChipContextMenuItems({
|
|
13826
|
+
tabGroup,
|
|
13827
|
+
group,
|
|
13828
|
+
api: this.accessor.api,
|
|
13829
|
+
event
|
|
13830
|
+
});
|
|
13831
|
+
if (items.length === 0) return;
|
|
13832
|
+
event.preventDefault();
|
|
13833
|
+
const popupService = this.accessor.getPopupServiceForGroup(group);
|
|
13834
|
+
const close = () => popupService.close();
|
|
13835
|
+
const menuEl = document.createElement("div");
|
|
13836
|
+
menuEl.className = "dv-context-menu";
|
|
13837
|
+
menuEl.setAttribute("role", "menu");
|
|
13838
|
+
for (const item of items) if (item === "separator") menuEl.appendChild(buildSeparator());
|
|
13839
|
+
else if (item === "rename") menuEl.appendChild(buildRenameInput(tabGroup));
|
|
13840
|
+
else if (item === "colorPicker") menuEl.appendChild(buildColorPicker(tabGroup, this.accessor.tabGroupColorPalette));
|
|
13841
|
+
else if (item === "collapse") menuEl.appendChild(this.buildCollapseItem(tabGroup, close));
|
|
13842
|
+
else if (item === "close") menuEl.appendChild(buildItem("Close All", close, () => {
|
|
13843
|
+
group.panels.filter((p) => tabGroup.containsPanel(p.id)).forEach((p) => p.api.close());
|
|
13844
|
+
}));
|
|
13845
|
+
else if (isItemConfig(item)) this.appendConfigItem(menuEl, item, { tabGroup }, group, close);
|
|
13846
|
+
popupService.openPopover(menuEl, {
|
|
13847
|
+
x: event.clientX,
|
|
13848
|
+
y: event.clientY,
|
|
13849
|
+
zIndex: popoverZIndexFor(event.target, group)
|
|
13850
|
+
});
|
|
13851
|
+
}
|
|
13852
|
+
};
|
|
13853
|
+
const ContextMenuModule = defineModule({
|
|
13854
|
+
name: "ContextMenu",
|
|
13855
|
+
serviceKey: "contextMenuService",
|
|
13856
|
+
create: (host) => new ContextMenuController(host)
|
|
13857
|
+
});
|
|
13858
|
+
|
|
13586
13859
|
//#endregion
|
|
13587
13860
|
//#region src/dockview/allModules.ts
|
|
13588
13861
|
/**
|
|
@@ -13600,7 +13873,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
13600
13873
|
HeaderActionsModule,
|
|
13601
13874
|
LiveRegionModule,
|
|
13602
13875
|
AdvancedDnDModule,
|
|
13603
|
-
TabGroupChipsModule
|
|
13876
|
+
TabGroupChipsModule,
|
|
13877
|
+
ContextMenuModule
|
|
13604
13878
|
];
|
|
13605
13879
|
|
|
13606
13880
|
//#endregion
|
|
@@ -14292,6 +14566,14 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14292
14566
|
//#endregion
|
|
14293
14567
|
//#region src/dnd/dropTargetAnchorContainer.ts
|
|
14294
14568
|
var DropTargetAnchorContainer = class extends CompositeDisposable {
|
|
14569
|
+
/**
|
|
14570
|
+
* The element the live overlay was rendered for, `undefined` when nothing
|
|
14571
|
+
* is showing. The container is shared by every drop target, so a caller
|
|
14572
|
+
* tearing down only its own overlay must check this before `clear()`.
|
|
14573
|
+
*/
|
|
14574
|
+
get renderedOutline() {
|
|
14575
|
+
return this._model ? this._outline : void 0;
|
|
14576
|
+
}
|
|
14295
14577
|
get disabled() {
|
|
14296
14578
|
return this._disabled;
|
|
14297
14579
|
}
|
|
@@ -14596,6 +14878,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14596
14878
|
const index = position === "top" ? this._topIndex : this._bottomIndex;
|
|
14597
14879
|
if (index !== void 0) this._splitview.resizeView(index, size);
|
|
14598
14880
|
}
|
|
14881
|
+
/** The inner splitview's primary-axis (height) extent; zero until laid out. */
|
|
14882
|
+
get axisSize() {
|
|
14883
|
+
return this._splitview.size;
|
|
14884
|
+
}
|
|
14599
14885
|
updateMargin(gap) {
|
|
14600
14886
|
this._splitview.margin = gap;
|
|
14601
14887
|
}
|
|
@@ -14608,6 +14894,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14608
14894
|
constructor(container, dockviewElement, layoutGrid, gap = 0, defaultCollapsedSize = 35) {
|
|
14609
14895
|
this._disposables = new CompositeDisposable();
|
|
14610
14896
|
this._viewConfigs = /* @__PURE__ */ new Map();
|
|
14897
|
+
this._pendingSizes = /* @__PURE__ */ new Map();
|
|
14611
14898
|
this._currentWidth = 0;
|
|
14612
14899
|
this._currentHeight = 0;
|
|
14613
14900
|
this._gap = gap;
|
|
@@ -14698,11 +14985,13 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14698
14985
|
break;
|
|
14699
14986
|
}
|
|
14700
14987
|
this._disposables.addDisposables(view);
|
|
14988
|
+
if (!view.isCollapsed && !this._canResize(position)) this._pendingSizes.set(position, initialSize);
|
|
14701
14989
|
this.updateTheme(this._gap, this._defaultCollapsedSize);
|
|
14702
14990
|
return view;
|
|
14703
14991
|
}
|
|
14704
14992
|
layout(width, height) {
|
|
14705
14993
|
this._outerSplitview.layout(width, height);
|
|
14994
|
+
this._flushPendingSizes();
|
|
14706
14995
|
}
|
|
14707
14996
|
/**
|
|
14708
14997
|
* Called when the active theme changes. Updates splitview margins and
|
|
@@ -14766,6 +15055,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14766
15055
|
this._disposables.removeDisposable(view);
|
|
14767
15056
|
view.dispose();
|
|
14768
15057
|
this._viewConfigs.delete(position);
|
|
15058
|
+
this._pendingSizes.delete(position);
|
|
14769
15059
|
this.updateTheme(this._gap, this._defaultCollapsedSize);
|
|
14770
15060
|
}
|
|
14771
15061
|
hasEdgeGroup(position) {
|
|
@@ -14789,6 +15079,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14789
15079
|
this._middleColumn.setViewVisible(position, visible);
|
|
14790
15080
|
break;
|
|
14791
15081
|
}
|
|
15082
|
+
if (visible) this._flushPendingSizes();
|
|
14792
15083
|
}
|
|
14793
15084
|
isEdgeGroupVisible(position) {
|
|
14794
15085
|
switch (position) {
|
|
@@ -14806,20 +15097,63 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14806
15097
|
const view = this._getView(position);
|
|
14807
15098
|
if (!view) return;
|
|
14808
15099
|
view.setCollapsed(collapsed);
|
|
14809
|
-
|
|
15100
|
+
if (collapsed) {
|
|
15101
|
+
this._pendingSizes.delete(position);
|
|
15102
|
+
this._resizeView(position, view.collapsedSize);
|
|
15103
|
+
} else this.resizeEdgeGroup(position, view.lastExpandedSize);
|
|
15104
|
+
}
|
|
15105
|
+
/**
|
|
15106
|
+
* Resize the edge group at `position` along its primary axis (width for
|
|
15107
|
+
* `left`/`right`, height for `top`/`bottom`), clamped by the group's
|
|
15108
|
+
* constraints and the space available. Where `groupApi.setSize` lands.
|
|
15109
|
+
*
|
|
15110
|
+
* The size becomes the group's expanded size, so a collapsed group keeps
|
|
15111
|
+
* its strip and takes it on expand, and it survives a `toJSON` round-trip.
|
|
15112
|
+
*/
|
|
15113
|
+
resizeEdgeGroup(position, size) {
|
|
15114
|
+
const view = this._getView(position);
|
|
15115
|
+
if (!view || !Number.isFinite(size)) return;
|
|
15116
|
+
const target = Math.round(size);
|
|
15117
|
+
if (target <= 0) return;
|
|
15118
|
+
view.restoreExpandedSize(target);
|
|
15119
|
+
if (view.isCollapsed) {
|
|
15120
|
+
this._pendingSizes.delete(position);
|
|
15121
|
+
return;
|
|
15122
|
+
}
|
|
15123
|
+
if (this._canResize(position)) {
|
|
15124
|
+
this._pendingSizes.delete(position);
|
|
15125
|
+
this._resizeView(position, target);
|
|
15126
|
+
} else this._pendingSizes.set(position, target);
|
|
15127
|
+
}
|
|
15128
|
+
/** A resize lands only on a visible view (a hidden one is pinned to zero)
|
|
15129
|
+
* whose splitview has extent to distribute. */
|
|
15130
|
+
_canResize(position) {
|
|
15131
|
+
if (!this.isEdgeGroupVisible(position)) return false;
|
|
15132
|
+
return (position === "left" || position === "right" ? this._outerSplitview.size : this._middleColumn.axisSize) > 0;
|
|
15133
|
+
}
|
|
15134
|
+
_resizeView(position, size) {
|
|
14810
15135
|
switch (position) {
|
|
14811
15136
|
case "left":
|
|
14812
|
-
if (this._leftIndex !== void 0) this._outerSplitview.resizeView(this._leftIndex,
|
|
15137
|
+
if (this._leftIndex !== void 0) this._outerSplitview.resizeView(this._leftIndex, size);
|
|
14813
15138
|
break;
|
|
14814
15139
|
case "right":
|
|
14815
|
-
if (this._rightIndex !== void 0) this._outerSplitview.resizeView(this._rightIndex,
|
|
15140
|
+
if (this._rightIndex !== void 0) this._outerSplitview.resizeView(this._rightIndex, size);
|
|
14816
15141
|
break;
|
|
14817
15142
|
case "top":
|
|
14818
15143
|
case "bottom":
|
|
14819
|
-
this._middleColumn.resizeView(position,
|
|
15144
|
+
this._middleColumn.resizeView(position, size);
|
|
14820
15145
|
break;
|
|
14821
15146
|
}
|
|
14822
15147
|
}
|
|
15148
|
+
_flushPendingSizes() {
|
|
15149
|
+
if (this._pendingSizes.size === 0) return;
|
|
15150
|
+
for (const [position, size] of this._pendingSizes) {
|
|
15151
|
+
const view = this._getView(position);
|
|
15152
|
+
if (!view || view.isCollapsed || !this._canResize(position)) continue;
|
|
15153
|
+
this._pendingSizes.delete(position);
|
|
15154
|
+
this._resizeView(position, size);
|
|
15155
|
+
}
|
|
15156
|
+
}
|
|
14823
15157
|
isEdgeGroupCollapsed(position) {
|
|
14824
15158
|
var _this$_getView$isColl, _this$_getView;
|
|
14825
15159
|
return (_this$_getView$isColl = (_this$_getView = this._getView(position)) === null || _this$_getView === void 0 ? void 0 : _this$_getView.isCollapsed) !== null && _this$_getView$isColl !== void 0 ? _this$_getView$isColl : false;
|
|
@@ -14845,15 +15179,17 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14845
15179
|
maximumSize: Number.isFinite(view.configuredMaximumSize) ? view.configuredMaximumSize : void 0,
|
|
14846
15180
|
collapsedSize: view.configuredCollapsedSize
|
|
14847
15181
|
});
|
|
14848
|
-
const expandedSize = (view, isVisible, liveSize, cachedVisibleSize) => {
|
|
15182
|
+
const expandedSize = (view, position, isVisible, liveSize, cachedVisibleSize) => {
|
|
14849
15183
|
if (view.isCollapsed) return view.lastExpandedSize;
|
|
15184
|
+
const pending = this._pendingSizes.get(position);
|
|
15185
|
+
if (pending !== void 0) return pending;
|
|
14850
15186
|
if (!isVisible) return cachedVisibleSize !== null && cachedVisibleSize !== void 0 ? cachedVisibleSize : view.lastExpandedSize;
|
|
14851
15187
|
return liveSize;
|
|
14852
15188
|
};
|
|
14853
15189
|
if (this._leftView && this._leftIndex !== void 0) {
|
|
14854
15190
|
const visible = this._outerSplitview.isViewVisible(this._leftIndex);
|
|
14855
15191
|
edgeGroups.left = _objectSpread2({
|
|
14856
|
-
size: expandedSize(this._leftView, visible, this._outerSplitview.getViewSize(this._leftIndex), this._outerSplitview.getViewCachedVisibleSize(this._leftIndex)),
|
|
15192
|
+
size: expandedSize(this._leftView, "left", visible, this._outerSplitview.getViewSize(this._leftIndex), this._outerSplitview.getViewCachedVisibleSize(this._leftIndex)),
|
|
14857
15193
|
visible,
|
|
14858
15194
|
collapsed: this._leftView.isCollapsed || void 0
|
|
14859
15195
|
}, constraints(this._leftView));
|
|
@@ -14861,7 +15197,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14861
15197
|
if (this._rightView && this._rightIndex !== void 0) {
|
|
14862
15198
|
const visible = this._outerSplitview.isViewVisible(this._rightIndex);
|
|
14863
15199
|
edgeGroups.right = _objectSpread2({
|
|
14864
|
-
size: expandedSize(this._rightView, visible, this._outerSplitview.getViewSize(this._rightIndex), this._outerSplitview.getViewCachedVisibleSize(this._rightIndex)),
|
|
15200
|
+
size: expandedSize(this._rightView, "right", visible, this._outerSplitview.getViewSize(this._rightIndex), this._outerSplitview.getViewCachedVisibleSize(this._rightIndex)),
|
|
14865
15201
|
visible,
|
|
14866
15202
|
collapsed: this._rightView.isCollapsed || void 0
|
|
14867
15203
|
}, constraints(this._rightView));
|
|
@@ -14869,7 +15205,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14869
15205
|
if (this._topView) {
|
|
14870
15206
|
const visible = this._middleColumn.isViewVisible("top");
|
|
14871
15207
|
edgeGroups.top = _objectSpread2({
|
|
14872
|
-
size: expandedSize(this._topView, visible, this._middleColumn.getViewSize("top"), this._middleColumn.getViewCachedVisibleSize("top")),
|
|
15208
|
+
size: expandedSize(this._topView, "top", visible, this._middleColumn.getViewSize("top"), this._middleColumn.getViewCachedVisibleSize("top")),
|
|
14873
15209
|
visible,
|
|
14874
15210
|
collapsed: this._topView.isCollapsed || void 0
|
|
14875
15211
|
}, constraints(this._topView));
|
|
@@ -14877,7 +15213,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14877
15213
|
if (this._bottomView) {
|
|
14878
15214
|
const visible = this._middleColumn.isViewVisible("bottom");
|
|
14879
15215
|
edgeGroups.bottom = _objectSpread2({
|
|
14880
|
-
size: expandedSize(this._bottomView, visible, this._middleColumn.getViewSize("bottom"), this._middleColumn.getViewCachedVisibleSize("bottom")),
|
|
15216
|
+
size: expandedSize(this._bottomView, "bottom", visible, this._middleColumn.getViewSize("bottom"), this._middleColumn.getViewCachedVisibleSize("bottom")),
|
|
14881
15217
|
visible,
|
|
14882
15218
|
collapsed: this._bottomView.isCollapsed || void 0
|
|
14883
15219
|
}, constraints(this._bottomView));
|
|
@@ -14885,33 +15221,23 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14885
15221
|
return edgeGroups;
|
|
14886
15222
|
}
|
|
14887
15223
|
fromJSON(data) {
|
|
14888
|
-
|
|
14889
|
-
|
|
14890
|
-
|
|
14891
|
-
|
|
14892
|
-
|
|
14893
|
-
|
|
14894
|
-
|
|
14895
|
-
|
|
14896
|
-
|
|
14897
|
-
(
|
|
14898
|
-
|
|
14899
|
-
|
|
14900
|
-
if (
|
|
14901
|
-
|
|
14902
|
-
|
|
14903
|
-
|
|
14904
|
-
|
|
14905
|
-
(_this$_topView3 = this._topView) === null || _this$_topView3 === void 0 || _this$_topView3.setCollapsed((_data$top$collapsed = data.top.collapsed) !== null && _data$top$collapsed !== void 0 ? _data$top$collapsed : false);
|
|
14906
|
-
this._middleColumn.resizeView("top", data.top.collapsed ? (_this$_topView$collap = (_this$_topView4 = this._topView) === null || _this$_topView4 === void 0 ? void 0 : _this$_topView4.collapsedSize) !== null && _this$_topView$collap !== void 0 ? _this$_topView$collap : data.top.size : data.top.size);
|
|
14907
|
-
if (!data.top.visible) this._middleColumn.setViewVisible("top", false);
|
|
14908
|
-
}
|
|
14909
|
-
if (data.bottom) {
|
|
14910
|
-
var _this$_bottomView2, _this$_bottomView3, _data$bottom$collapse, _this$_bottomView$col, _this$_bottomView4;
|
|
14911
|
-
(_this$_bottomView2 = this._bottomView) === null || _this$_bottomView2 === void 0 || _this$_bottomView2.restoreExpandedSize(data.bottom.size);
|
|
14912
|
-
(_this$_bottomView3 = this._bottomView) === null || _this$_bottomView3 === void 0 || _this$_bottomView3.setCollapsed((_data$bottom$collapse = data.bottom.collapsed) !== null && _data$bottom$collapse !== void 0 ? _data$bottom$collapse : false);
|
|
14913
|
-
this._middleColumn.resizeView("bottom", data.bottom.collapsed ? (_this$_bottomView$col = (_this$_bottomView4 = this._bottomView) === null || _this$_bottomView4 === void 0 ? void 0 : _this$_bottomView4.collapsedSize) !== null && _this$_bottomView$col !== void 0 ? _this$_bottomView$col : data.bottom.size : data.bottom.size);
|
|
14914
|
-
if (!data.bottom.visible) this._middleColumn.setViewVisible("bottom", false);
|
|
15224
|
+
for (const position of [
|
|
15225
|
+
"left",
|
|
15226
|
+
"right",
|
|
15227
|
+
"top",
|
|
15228
|
+
"bottom"
|
|
15229
|
+
]) {
|
|
15230
|
+
var _state$collapsed;
|
|
15231
|
+
const state = data[position];
|
|
15232
|
+
const view = this._getView(position);
|
|
15233
|
+
if (!state || !view) continue;
|
|
15234
|
+
view.restoreExpandedSize(state.size);
|
|
15235
|
+
view.setCollapsed((_state$collapsed = state.collapsed) !== null && _state$collapsed !== void 0 ? _state$collapsed : false);
|
|
15236
|
+
if (state.collapsed) {
|
|
15237
|
+
this._pendingSizes.delete(position);
|
|
15238
|
+
this._resizeView(position, view.collapsedSize);
|
|
15239
|
+
} else this.resizeEdgeGroup(position, state.size);
|
|
15240
|
+
this.setEdgeGroupVisible(position, !!state.visible);
|
|
14915
15241
|
}
|
|
14916
15242
|
}
|
|
14917
15243
|
dispose() {
|
|
@@ -16296,6 +16622,13 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
16296
16622
|
position
|
|
16297
16623
|
};
|
|
16298
16624
|
group.model.headerPosition = position;
|
|
16625
|
+
const resizeDisposable = group.onDidChange((event) => {
|
|
16626
|
+
var _this$_shellManager3;
|
|
16627
|
+
if (!event) return;
|
|
16628
|
+
const size = position === "left" || position === "right" ? event.width : event.height;
|
|
16629
|
+
if (typeof size !== "number") return;
|
|
16630
|
+
(_this$_shellManager3 = this._shellManager) === null || _this$_shellManager3 === void 0 || _this$_shellManager3.resizeEdgeGroup(position, size);
|
|
16631
|
+
});
|
|
16299
16632
|
const autoCollapseDisposable = group.model.onDidRemovePanel(() => {
|
|
16300
16633
|
if (!group.model.isEmpty) return;
|
|
16301
16634
|
if (service.isAutoReveal(group)) queueMicrotask(() => {
|
|
@@ -16304,7 +16637,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
16304
16637
|
});
|
|
16305
16638
|
else this.setEdgeGroupCollapsed(group, true);
|
|
16306
16639
|
});
|
|
16307
|
-
service.add(position, group, autoCollapseDisposable);
|
|
16640
|
+
service.add(position, group, new CompositeDisposable(autoCollapseDisposable, resizeDisposable));
|
|
16308
16641
|
if (options.autoHide !== void 0) service.setAutoHide(group, options.autoHide);
|
|
16309
16642
|
if (options.autoReveal !== void 0) service.setAutoReveal(group, options.autoReveal);
|
|
16310
16643
|
this._onDidAddGroup.fire(group);
|
|
@@ -16399,8 +16732,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
16399
16732
|
}
|
|
16400
16733
|
/** The size an edge group expands to (pre-collapse); sizes the peek. */
|
|
16401
16734
|
getEdgeGroupExpandedSize(position) {
|
|
16402
|
-
var _this$_shellManager$g, _this$
|
|
16403
|
-
return (_this$_shellManager$g = (_this$
|
|
16735
|
+
var _this$_shellManager$g, _this$_shellManager4;
|
|
16736
|
+
return (_this$_shellManager$g = (_this$_shellManager4 = this._shellManager) === null || _this$_shellManager4 === void 0 ? void 0 : _this$_shellManager4.getEdgeGroupExpandedSize(position)) !== null && _this$_shellManager$g !== void 0 ? _this$_shellManager$g : 0;
|
|
16404
16737
|
}
|
|
16405
16738
|
/** Reposition a single `renderer:'always'` panel's overlay over its
|
|
16406
16739
|
* reference container, optionally forcing it visible (the auto-hide peek
|
|
@@ -17561,7 +17894,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17561
17894
|
}));
|
|
17562
17895
|
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
17563
17896
|
const updatedTargetLocation = getRelativeLocation(destinationGridview.orientation, getGridLocation(destinationGroup.element), destinationTarget);
|
|
17564
|
-
const newGroup = this.createGroupAtLocation(updatedTargetLocation,
|
|
17897
|
+
const newGroup = this.createGroupAtLocation(updatedTargetLocation, this.dropSizing(getGridLocation(destinationGroup.element)), void 0, destinationGridview);
|
|
17565
17898
|
this.movingLock(() => newGroup.model.openPanel(removedPanel, { skipSetActive: true }));
|
|
17566
17899
|
this.doSetGroupAndPanelActive(newGroup);
|
|
17567
17900
|
this.fireDidMovePanel(this.getGroupPanel(sourceItemId), sourceGroup);
|
|
@@ -17578,7 +17911,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17578
17911
|
skipSetActiveGroup: true
|
|
17579
17912
|
}));
|
|
17580
17913
|
if (!removedPanel) throw new Error(`dockview: No panel with id ${sourceItemId}`);
|
|
17581
|
-
const newGroup = this.createGroupAtLocation(targetLocation,
|
|
17914
|
+
const newGroup = this.createGroupAtLocation(targetLocation, this.dropSizing(referenceLocation), void 0, destinationGridview);
|
|
17582
17915
|
this.movingLock(() => newGroup.model.openPanel(removedPanel, { skipSetGroupActive: true }));
|
|
17583
17916
|
this.doSetGroupAndPanelActive(newGroup);
|
|
17584
17917
|
this.fireDidMovePanel(removedPanel, sourceGroup);
|
|
@@ -17590,7 +17923,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17590
17923
|
}));
|
|
17591
17924
|
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
17592
17925
|
const location = getRelativeLocation(destinationGridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
17593
|
-
this.movingLock(() => this.doAddGroup(targetGroup, location,
|
|
17926
|
+
this.movingLock(() => this.doAddGroup(targetGroup, location, this.dropSizing(updatedReferenceLocation), destinationGridview));
|
|
17594
17927
|
this.setGroupLocationForRoot(targetGroup, destinationGridview);
|
|
17595
17928
|
this.doSetGroupAndPanelActive(targetGroup);
|
|
17596
17929
|
this.fireDidMovePanel(this.getGroupPanel(sourceItemId), sourceGroup);
|
|
@@ -17605,7 +17938,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17605
17938
|
}));
|
|
17606
17939
|
if (!removedPanel) throw new Error(`dockview: No panel with id ${sourceItemId}`);
|
|
17607
17940
|
const dropLocation = getRelativeLocation(destinationGridview.orientation, referenceLocation, destinationTarget);
|
|
17608
|
-
const group = this.createGroupAtLocation(dropLocation,
|
|
17941
|
+
const group = this.createGroupAtLocation(dropLocation, this.dropSizing(referenceLocation), void 0, destinationGridview);
|
|
17609
17942
|
this.movingLock(() => group.model.openPanel(removedPanel, { skipSetGroupActive: true }));
|
|
17610
17943
|
this.doSetGroupAndPanelActive(group);
|
|
17611
17944
|
this.fireDidMovePanel(removedPanel, sourceGroup);
|
|
@@ -17649,7 +17982,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17649
17982
|
if (!destinationTarget || destinationTarget === "center" || !referenceLocation) targetGroup = destinationGroup;
|
|
17650
17983
|
else {
|
|
17651
17984
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
17652
|
-
targetGroup = this.createGroupAtLocation(dropLocation);
|
|
17985
|
+
targetGroup = this.createGroupAtLocation(dropLocation, this.dropSizing(referenceLocation));
|
|
17653
17986
|
}
|
|
17654
17987
|
if (!options.keepEmptyGroups && sourceGroup.model.size === 0 && sourceGroup !== targetGroup) this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
17655
17988
|
addPanelsToGroup(targetGroup);
|
|
@@ -17700,6 +18033,21 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17700
18033
|
if (options.skipSetActive !== true) this.doSetGroupAndPanelActive(to);
|
|
17701
18034
|
else if (!this.activePanel) this.doSetGroupAndPanelActive(to);
|
|
17702
18035
|
} else {
|
|
18036
|
+
const isReorderWithinBranch = (() => {
|
|
18037
|
+
if (from.api.location.type === "edge" || to.api.location.type === "edge") return false;
|
|
18038
|
+
const root = this.getGridviewForGroup(from);
|
|
18039
|
+
if (root !== this.getGridviewForGroup(to)) return false;
|
|
18040
|
+
let fromLocation;
|
|
18041
|
+
let toLocation;
|
|
18042
|
+
try {
|
|
18043
|
+
fromLocation = getGridLocation(from.element);
|
|
18044
|
+
toLocation = getGridLocation(to.element);
|
|
18045
|
+
} catch (_unused) {
|
|
18046
|
+
return false;
|
|
18047
|
+
}
|
|
18048
|
+
if (fromLocation.length === 0 || toLocation.length === 0) return false;
|
|
18049
|
+
return sequenceEquals(tail(fromLocation)[0], tail(toLocation)[0]) && getLocationOrientation(root.orientation, toLocation) === getDirectionOrientation(target);
|
|
18050
|
+
})();
|
|
17703
18051
|
if (from.api.location.type === "edge") {
|
|
17704
18052
|
/**
|
|
17705
18053
|
* Edge groups are permanent structural elements and must
|
|
@@ -17765,13 +18113,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17765
18113
|
const referenceLocation = getGridLocation(to.element);
|
|
17766
18114
|
const dropLocation = getRelativeLocation(destGridview.orientation, referenceLocation, target);
|
|
17767
18115
|
let size;
|
|
17768
|
-
|
|
17769
|
-
|
|
17770
|
-
|
|
17771
|
-
|
|
17772
|
-
case "HORIZONTAL":
|
|
17773
|
-
size = referenceLocation.length % 2 == 0 ? from.api.height : from.api.width;
|
|
17774
|
-
break;
|
|
18116
|
+
if (isReorderWithinBranch) size = getDirectionOrientation(target) === "HORIZONTAL" ? from.api.width : from.api.height;
|
|
18117
|
+
else {
|
|
18118
|
+
var _referenceLocation;
|
|
18119
|
+
size = Sizing.Split((_referenceLocation = referenceLocation[referenceLocation.length - 1]) !== null && _referenceLocation !== void 0 ? _referenceLocation : 0);
|
|
17775
18120
|
}
|
|
17776
18121
|
destGridview.addView(source, size, dropLocation);
|
|
17777
18122
|
this.setGroupLocationForRoot(source, destGridview);
|
|
@@ -17896,6 +18241,16 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17896
18241
|
});
|
|
17897
18242
|
return panel;
|
|
17898
18243
|
}
|
|
18244
|
+
/**
|
|
18245
|
+
* Sizing for a group created by a drop next to `referenceLocation`: half
|
|
18246
|
+
* of the group the overlay was drawn over, leaving its siblings alone, so
|
|
18247
|
+
* the panel lands in the region the overlay indicated (#1612). Gridview
|
|
18248
|
+
* rewrites the index to 0 when a cross-axis drop wraps the reference in a
|
|
18249
|
+
* new branch, so one value serves both paths.
|
|
18250
|
+
*/
|
|
18251
|
+
dropSizing(referenceLocation) {
|
|
18252
|
+
return Sizing.Split(referenceLocation.length === 0 ? 0 : referenceLocation[referenceLocation.length - 1]);
|
|
18253
|
+
}
|
|
17899
18254
|
createGroupAtLocation(location, size, options, gridview = this.gridview) {
|
|
17900
18255
|
const group = this.createGroup(options);
|
|
17901
18256
|
this.doAddGroup(group, location, size, gridview);
|
|
@@ -17955,22 +18310,22 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17955
18310
|
return location.length % 2 == 1 ? rootOrientation : orthogonal(rootOrientation);
|
|
17956
18311
|
}
|
|
17957
18312
|
updateTheme() {
|
|
17958
|
-
var _this$_options$theme, _this$_shellThemeClas, _theme$gap, _this$_popoutWindowSe23, _this$_popoutWindowSe24, _this$
|
|
18313
|
+
var _this$_options$theme, _this$_shellThemeClas, _theme$gap, _this$_popoutWindowSe23, _this$_popoutWindowSe24, _this$_shellManager5, _theme$edgeGroupColla, _theme$tabGroupIndica;
|
|
17959
18314
|
const theme = (_this$_options$theme = this._options.theme) !== null && _this$_options$theme !== void 0 ? _this$_options$theme : themeAbyss;
|
|
17960
18315
|
(_this$_shellThemeClas = this._shellThemeClassnames) === null || _this$_shellThemeClas === void 0 || _this$_shellThemeClas.setClassNames(theme.className);
|
|
17961
18316
|
const gap = (_theme$gap = theme.gap) !== null && _theme$gap !== void 0 ? _theme$gap : 0;
|
|
17962
18317
|
this.gridview.margin = gap;
|
|
17963
18318
|
for (const floating of this.floatingGroups) floating.gridview.margin = gap;
|
|
17964
18319
|
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;
|
|
17965
|
-
(_this$
|
|
18320
|
+
(_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);
|
|
17966
18321
|
if (theme.dndOverlayBorder === void 0) {
|
|
17967
|
-
var _this$
|
|
18322
|
+
var _this$_shellManager6;
|
|
17968
18323
|
this.element.style.removeProperty("--dv-drag-over-border");
|
|
17969
|
-
(_this$
|
|
18324
|
+
(_this$_shellManager6 = this._shellManager) === null || _this$_shellManager6 === void 0 || _this$_shellManager6.element.style.removeProperty("--dv-drag-over-border");
|
|
17970
18325
|
} else {
|
|
17971
|
-
var _this$
|
|
18326
|
+
var _this$_shellManager7;
|
|
17972
18327
|
this.element.style.setProperty("--dv-drag-over-border", theme.dndOverlayBorder);
|
|
17973
|
-
(_this$
|
|
18328
|
+
(_this$_shellManager7 = this._shellManager) === null || _this$_shellManager7 === void 0 || _this$_shellManager7.element.style.setProperty("--dv-drag-over-border", theme.dndOverlayBorder);
|
|
17974
18329
|
}
|
|
17975
18330
|
switch (theme.dndOverlayMounting) {
|
|
17976
18331
|
case "absolute":
|
|
@@ -18873,6 +19228,8 @@ exports.AdvancedDnDModule = AdvancedDnDModule;
|
|
|
18873
19228
|
exports.AdvancedDnDService = AdvancedDnDService;
|
|
18874
19229
|
exports.BaseGrid = BaseGrid;
|
|
18875
19230
|
exports.ContentContainer = ContentContainer;
|
|
19231
|
+
exports.ContextMenuController = ContextMenuController;
|
|
19232
|
+
exports.ContextMenuModule = ContextMenuModule;
|
|
18876
19233
|
exports.DEFAULT_TAB_GROUP_COLORS = DEFAULT_TAB_GROUP_COLORS;
|
|
18877
19234
|
exports.DefaultDockviewDeserialzier = DefaultDockviewDeserialzier;
|
|
18878
19235
|
exports.DefaultTab = DefaultTab;
|