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/package/main.cjs.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
|
*/
|
|
@@ -1050,8 +1050,14 @@ var Splitview = class {
|
|
|
1050
1050
|
container.appendChild(view.element);
|
|
1051
1051
|
let viewSize;
|
|
1052
1052
|
if (typeof size === "number") viewSize = size;
|
|
1053
|
-
else if (size.type === "split")
|
|
1054
|
-
|
|
1053
|
+
else if (size.type === "split") {
|
|
1054
|
+
const splitTarget = this.viewItems[size.index];
|
|
1055
|
+
if (splitTarget) {
|
|
1056
|
+
const half = Math.floor(splitTarget.size / 2);
|
|
1057
|
+
viewSize = splitTarget.size - half;
|
|
1058
|
+
splitTarget.size = half;
|
|
1059
|
+
} else viewSize = this.getViewSize(size.index) / 2;
|
|
1060
|
+
} else if (size.type === "invisible") viewSize = { cachedVisibleSize: size.cachedVisibleSize };
|
|
1055
1061
|
else viewSize = view.minimumSize;
|
|
1056
1062
|
const disposable = view.onDidChange((newSize) => this.onDidChange(viewItem, newSize.size));
|
|
1057
1063
|
const viewItem = new ViewItem(container, view, viewSize, { dispose: () => {
|
|
@@ -5796,7 +5802,7 @@ function resolveDndCapabilities(options) {
|
|
|
5796
5802
|
};
|
|
5797
5803
|
case "auto":
|
|
5798
5804
|
case void 0:
|
|
5799
|
-
default: return isCoarsePrimaryInput$
|
|
5805
|
+
default: return isCoarsePrimaryInput$2() ? {
|
|
5800
5806
|
html5: false,
|
|
5801
5807
|
pointer: true,
|
|
5802
5808
|
pointerHandlesMouse: true
|
|
@@ -5807,7 +5813,7 @@ function resolveDndCapabilities(options) {
|
|
|
5807
5813
|
};
|
|
5808
5814
|
}
|
|
5809
5815
|
}
|
|
5810
|
-
function isCoarsePrimaryInput$
|
|
5816
|
+
function isCoarsePrimaryInput$2() {
|
|
5811
5817
|
if (globalThis.window === void 0 || !globalThis.matchMedia) return false;
|
|
5812
5818
|
const coarse = globalThis.matchMedia("(pointer: coarse)").matches;
|
|
5813
5819
|
const fine = globalThis.matchMedia("(pointer: fine)").matches;
|
|
@@ -7962,11 +7968,28 @@ var TabReorderController = class extends CompositeDisposable {
|
|
|
7962
7968
|
if (this._voidContainer && related && (related === this._voidContainer || this._voidContainer.contains(related))) return;
|
|
7963
7969
|
this.resetTabTransforms();
|
|
7964
7970
|
if (this._animState.sourceIndex === -1) {
|
|
7965
|
-
|
|
7966
|
-
(_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();
|
|
7971
|
+
this.clearHeaderAnchorOverlay();
|
|
7967
7972
|
this._animState = null;
|
|
7968
7973
|
} else this._animState.currentInsertionIndex = null;
|
|
7969
7974
|
}
|
|
7975
|
+
/**
|
|
7976
|
+
* Clear the anchored overlay only when this header is what rendered it.
|
|
7977
|
+
* The container is shared with the group's content drop target, which
|
|
7978
|
+
* renders into it on the same frame the cursor leaves the strip: the
|
|
7979
|
+
* pointer backend calls `handleDragOver` on the new target before the
|
|
7980
|
+
* global `onDragMove` that reaches us (#1612).
|
|
7981
|
+
*/
|
|
7982
|
+
clearHeaderAnchorOverlay() {
|
|
7983
|
+
var _container$model;
|
|
7984
|
+
const container = this.group.model.dropTargetContainer;
|
|
7985
|
+
const outline = container === null || container === void 0 ? void 0 : container.renderedOutline;
|
|
7986
|
+
if (outline && ![
|
|
7987
|
+
this._tabsList,
|
|
7988
|
+
this._voidContainer,
|
|
7989
|
+
this._extendedDropZone
|
|
7990
|
+
].some((scope) => scope === null || scope === void 0 ? void 0 : scope.contains(outline))) return;
|
|
7991
|
+
container === null || container === void 0 || (_container$model = container.model) === null || _container$model === void 0 || _container$model.clear();
|
|
7992
|
+
}
|
|
7970
7993
|
handleDragOver(event) {
|
|
7971
7994
|
var _this$accessor$option2;
|
|
7972
7995
|
if (!this._animState) return;
|
|
@@ -12396,7 +12419,6 @@ const ENTERPRISE_MODULE_NAMES = /* @__PURE__ */ new Set([
|
|
|
12396
12419
|
"AdvancedOverflow",
|
|
12397
12420
|
"AutoEdgeGroup",
|
|
12398
12421
|
"AutoHideEdgeGroup",
|
|
12399
|
-
"ContextMenu",
|
|
12400
12422
|
"DndCompass",
|
|
12401
12423
|
"KeyboardDocking",
|
|
12402
12424
|
"KeyboardNavigation",
|
|
@@ -12478,8 +12500,8 @@ function logMissingModule(moduleName, reason) {
|
|
|
12478
12500
|
* case: calling `undo()` having never set the option at all.
|
|
12479
12501
|
*
|
|
12480
12502
|
* Interaction handlers are queries in this sense too: a right-click reaching an
|
|
12481
|
-
* absent
|
|
12482
|
-
*
|
|
12503
|
+
* absent module means the app never asked for that feature, so it stays silent
|
|
12504
|
+
* (`?.`) and the browser's own behaviour applies. Options are where intent is
|
|
12483
12505
|
* declared; see `optionsModules.ts`.
|
|
12484
12506
|
*/
|
|
12485
12507
|
function assertModule(service, moduleName, context) {
|
|
@@ -12559,10 +12581,9 @@ function clearRegisteredModules() {
|
|
|
12559
12581
|
*
|
|
12560
12582
|
* This is the "declared intent" diagnostic. It fires when the user asks for a
|
|
12561
12583
|
* feature via options, at construction and on every `updateOptions`. It
|
|
12562
|
-
* deliberately does *not* fire on user interaction:
|
|
12563
|
-
*
|
|
12564
|
-
*
|
|
12565
|
-
* app never wanted.
|
|
12584
|
+
* deliberately does *not* fire on user interaction: an interaction reaching an
|
|
12585
|
+
* absent module stays silent, because the `?.` service-slot call sites can't
|
|
12586
|
+
* tell a missing module from a feature the app never wanted.
|
|
12566
12587
|
*
|
|
12567
12588
|
* Rules are a flat list rather than a `Record<keyof DockviewOptions, ...>`
|
|
12568
12589
|
* because dockview's options are nested and value-gated: `overflow.mode:
|
|
@@ -12658,18 +12679,6 @@ const OPTION_MODULE_RULES = [
|
|
|
12658
12679
|
moduleName: "AutoEdgeGroup",
|
|
12659
12680
|
when: (o) => isAnyEdgeGroupEnabled(o.dockToEdgeGroups)
|
|
12660
12681
|
},
|
|
12661
|
-
{
|
|
12662
|
-
optionKey: "getTabContextMenuItems",
|
|
12663
|
-
reason: "getTabContextMenuItems",
|
|
12664
|
-
moduleName: "ContextMenu",
|
|
12665
|
-
when: (o) => o.getTabContextMenuItems != null
|
|
12666
|
-
},
|
|
12667
|
-
{
|
|
12668
|
-
optionKey: "getTabGroupChipContextMenuItems",
|
|
12669
|
-
reason: "getTabGroupChipContextMenuItems",
|
|
12670
|
-
moduleName: "ContextMenu",
|
|
12671
|
-
when: (o) => o.getTabGroupChipContextMenuItems != null
|
|
12672
|
-
},
|
|
12673
12682
|
{
|
|
12674
12683
|
optionKey: "dndCompass",
|
|
12675
12684
|
reason: "dndCompass",
|
|
@@ -13570,6 +13579,270 @@ const TabGroupChipsModule = defineModule({
|
|
|
13570
13579
|
}
|
|
13571
13580
|
});
|
|
13572
13581
|
|
|
13582
|
+
//#endregion
|
|
13583
|
+
//#region src/dockview/contextMenuService.ts
|
|
13584
|
+
function popoverZIndexFor(target, group) {
|
|
13585
|
+
var _group$api, _group$api$isPeeking;
|
|
13586
|
+
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)";
|
|
13587
|
+
if (!(target instanceof HTMLElement)) return;
|
|
13588
|
+
const relativeParent = findRelativeZIndexParent(target);
|
|
13589
|
+
return (relativeParent === null || relativeParent === void 0 ? void 0 : relativeParent.style.zIndex) ? `calc(${relativeParent.style.zIndex} * 2)` : void 0;
|
|
13590
|
+
}
|
|
13591
|
+
let _nextId = 0;
|
|
13592
|
+
const nextContextMenuItemId = () => `dv-ctx-menu-item-${_nextId++}`;
|
|
13593
|
+
function isItemConfig(item) {
|
|
13594
|
+
return typeof item === "object";
|
|
13595
|
+
}
|
|
13596
|
+
function buildItem(label, close, action, disabled) {
|
|
13597
|
+
const el = document.createElement("div");
|
|
13598
|
+
el.className = "dv-context-menu-item";
|
|
13599
|
+
el.setAttribute("role", "menuitem");
|
|
13600
|
+
if (disabled) {
|
|
13601
|
+
el.classList.add("dv-context-menu-item--disabled");
|
|
13602
|
+
el.setAttribute("aria-disabled", "true");
|
|
13603
|
+
}
|
|
13604
|
+
el.textContent = label;
|
|
13605
|
+
if (!disabled) el.addEventListener("click", () => {
|
|
13606
|
+
action();
|
|
13607
|
+
close();
|
|
13608
|
+
});
|
|
13609
|
+
return el;
|
|
13610
|
+
}
|
|
13611
|
+
function buildSeparator() {
|
|
13612
|
+
const el = document.createElement("div");
|
|
13613
|
+
el.className = "dv-context-menu-separator";
|
|
13614
|
+
el.setAttribute("role", "separator");
|
|
13615
|
+
return el;
|
|
13616
|
+
}
|
|
13617
|
+
function isCoarsePrimaryInput$1() {
|
|
13618
|
+
if (globalThis.window === void 0 || !globalThis.matchMedia) return false;
|
|
13619
|
+
const coarse = globalThis.matchMedia("(pointer: coarse)").matches;
|
|
13620
|
+
const fine = globalThis.matchMedia("(pointer: fine)").matches;
|
|
13621
|
+
return coarse && !fine;
|
|
13622
|
+
}
|
|
13623
|
+
function buildRenameInput(tabGroup) {
|
|
13624
|
+
const wrapper = document.createElement("div");
|
|
13625
|
+
wrapper.className = "dv-context-menu-rename";
|
|
13626
|
+
const input = document.createElement("input");
|
|
13627
|
+
input.className = "dv-context-menu-rename-input";
|
|
13628
|
+
input.type = "text";
|
|
13629
|
+
input.placeholder = "Name This Group";
|
|
13630
|
+
input.value = tabGroup.label;
|
|
13631
|
+
input.addEventListener("input", () => {
|
|
13632
|
+
tabGroup.setLabel(input.value);
|
|
13633
|
+
});
|
|
13634
|
+
input.addEventListener("keydown", (e) => {
|
|
13635
|
+
if (e.key !== "Escape" && e.key !== "Enter") e.stopPropagation();
|
|
13636
|
+
});
|
|
13637
|
+
input.addEventListener("click", (e) => {
|
|
13638
|
+
e.stopPropagation();
|
|
13639
|
+
});
|
|
13640
|
+
wrapper.appendChild(input);
|
|
13641
|
+
if (!isCoarsePrimaryInput$1()) requestAnimationFrame(() => {
|
|
13642
|
+
input.focus();
|
|
13643
|
+
input.select();
|
|
13644
|
+
});
|
|
13645
|
+
return wrapper;
|
|
13646
|
+
}
|
|
13647
|
+
function buildColorPicker(tabGroup, palette) {
|
|
13648
|
+
const wrapper = document.createElement("div");
|
|
13649
|
+
wrapper.className = "dv-context-menu-color-picker";
|
|
13650
|
+
if (!palette.enabled) return wrapper;
|
|
13651
|
+
for (const entry of palette.entries()) {
|
|
13652
|
+
const swatch = document.createElement("div");
|
|
13653
|
+
swatch.className = "dv-context-menu-color-swatch";
|
|
13654
|
+
swatch.style.setProperty("--dv-tab-group-color", entry.value);
|
|
13655
|
+
if (entry.label) swatch.title = entry.label;
|
|
13656
|
+
if (tabGroup.color === entry.id) swatch.classList.add("dv-context-menu-color-swatch--selected");
|
|
13657
|
+
swatch.addEventListener("click", () => {
|
|
13658
|
+
tabGroup.setColor(entry.id);
|
|
13659
|
+
});
|
|
13660
|
+
wrapper.appendChild(swatch);
|
|
13661
|
+
}
|
|
13662
|
+
return wrapper;
|
|
13663
|
+
}
|
|
13664
|
+
var ContextMenuController = class {
|
|
13665
|
+
constructor(accessor) {
|
|
13666
|
+
this.accessor = accessor;
|
|
13667
|
+
}
|
|
13668
|
+
/**
|
|
13669
|
+
* A single maximize/restore toggle whose label and behaviour track the
|
|
13670
|
+
* group's live state: it reads *Restore* + calls `exitMaximized` when the
|
|
13671
|
+
* group is maximized, otherwise *Maximize* + `maximize`. Only grid groups
|
|
13672
|
+
* can be maximized, so the item is disabled for floating / popout panels
|
|
13673
|
+
* that are not already maximized.
|
|
13674
|
+
*/
|
|
13675
|
+
buildMaximizeItem(panel, close) {
|
|
13676
|
+
const isMaximized = panel.api.isMaximized();
|
|
13677
|
+
return buildItem(isMaximized ? "Restore" : "Maximize", close, isMaximized ? () => panel.api.exitMaximized() : () => panel.api.maximize(), !isMaximized && panel.api.location.type !== "grid");
|
|
13678
|
+
}
|
|
13679
|
+
/**
|
|
13680
|
+
* A single collapse/expand toggle whose label tracks the tab group's live
|
|
13681
|
+
* state: *Expand* when the group is already collapsed, otherwise *Collapse*.
|
|
13682
|
+
*/
|
|
13683
|
+
buildCollapseItem(tabGroup, close) {
|
|
13684
|
+
return buildItem(tabGroup.collapsed ? "Expand" : "Collapse", close, () => tabGroup.toggle());
|
|
13685
|
+
}
|
|
13686
|
+
/**
|
|
13687
|
+
* Whether to auto-inject the built-in Pin/Unpin item at the top of the tab
|
|
13688
|
+
* menu. True only when the PinnedTabs module is registered, pinning is
|
|
13689
|
+
* enabled, and the app has not opted out via `pinnedTabs.contextMenuItem:
|
|
13690
|
+
* false` (the item is on by default). This keeps pinning reachable from the
|
|
13691
|
+
* menu without the app having to return `'pin'` from
|
|
13692
|
+
* `getTabContextMenuItems` itself.
|
|
13693
|
+
*/
|
|
13694
|
+
_shouldInjectPin() {
|
|
13695
|
+
const pinnedTabs = this.accessor.options.pinnedTabs;
|
|
13696
|
+
return !!this.accessor.pinnedTabsService && !!(pinnedTabs === null || pinnedTabs === void 0 ? void 0 : pinnedTabs.enabled) && pinnedTabs.contextMenuItem !== false;
|
|
13697
|
+
}
|
|
13698
|
+
/**
|
|
13699
|
+
* The tab menu items: the app's own items (if any) with the built-in
|
|
13700
|
+
* `'pin'` item prepended when {@link _shouldInjectPin} applies, so the app
|
|
13701
|
+
* keeps full control of its list, and pinning is added without disturbing
|
|
13702
|
+
* it. Reuses the existing `'pin'` token rendering below.
|
|
13703
|
+
*/
|
|
13704
|
+
_resolveTabItems(panel, group, event) {
|
|
13705
|
+
var _this$accessor$option, _this$accessor$option2, _this$accessor$option3;
|
|
13706
|
+
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, {
|
|
13707
|
+
panel,
|
|
13708
|
+
group,
|
|
13709
|
+
api: this.accessor.api,
|
|
13710
|
+
event
|
|
13711
|
+
})) !== null && _this$accessor$option !== void 0 ? _this$accessor$option : [];
|
|
13712
|
+
return this._shouldInjectPin() ? ["pin", ...appItems] : appItems;
|
|
13713
|
+
}
|
|
13714
|
+
/**
|
|
13715
|
+
* Render a custom `component` menu item and append it to `menuEl`. Builds
|
|
13716
|
+
* the framework renderer via the host's `createContextMenuItemComponent`
|
|
13717
|
+
* factory and initialises it. Shared by the tab menu and the chip menu,
|
|
13718
|
+
* which differ only in `identity`: the tab menu passes the `panel`, the chip
|
|
13719
|
+
* menu passes the `tabGroup`. No-op when no renderer could be created (no
|
|
13720
|
+
* factory configured, or the factory declined the component).
|
|
13721
|
+
*/
|
|
13722
|
+
appendComponentItem(menuEl, item, identity, group, close) {
|
|
13723
|
+
var _this$accessor$option4, _this$accessor$option5;
|
|
13724
|
+
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, {
|
|
13725
|
+
id: nextContextMenuItemId(),
|
|
13726
|
+
component: item.component
|
|
13727
|
+
});
|
|
13728
|
+
if (!renderer) return;
|
|
13729
|
+
renderer.init(_objectSpread2(_objectSpread2({}, identity), {}, {
|
|
13730
|
+
group,
|
|
13731
|
+
api: this.accessor.api,
|
|
13732
|
+
close,
|
|
13733
|
+
componentProps: item.componentProps
|
|
13734
|
+
}));
|
|
13735
|
+
menuEl.appendChild(renderer.element);
|
|
13736
|
+
}
|
|
13737
|
+
/**
|
|
13738
|
+
* The element for one built-in tab item, or `undefined` for a token this
|
|
13739
|
+
* version doesn't know (an app on a newer typings version, or plain JS):
|
|
13740
|
+
* an unrecognised token renders nothing rather than throwing.
|
|
13741
|
+
*/
|
|
13742
|
+
buildBuiltInTabItem(item, panel, group, close) {
|
|
13743
|
+
switch (item) {
|
|
13744
|
+
case "separator": return buildSeparator();
|
|
13745
|
+
case "close": return buildItem("Close", close, () => panel.api.close());
|
|
13746
|
+
case "closeOthers": return buildItem("Close Others", close, () => {
|
|
13747
|
+
group.panels.filter((p) => p !== panel).forEach((p) => p.api.close());
|
|
13748
|
+
});
|
|
13749
|
+
case "closeAll": return buildItem("Close All", close, () => {
|
|
13750
|
+
[...group.panels].forEach((p) => p.api.close());
|
|
13751
|
+
});
|
|
13752
|
+
case "closeLeft": {
|
|
13753
|
+
const index = group.panels.indexOf(panel);
|
|
13754
|
+
return buildItem("Close to the Left", close, () => {
|
|
13755
|
+
group.panels.filter((_, i) => i < index).forEach((p) => p.api.close());
|
|
13756
|
+
}, index <= 0);
|
|
13757
|
+
}
|
|
13758
|
+
case "closeRight": {
|
|
13759
|
+
const index = group.panels.indexOf(panel);
|
|
13760
|
+
return buildItem("Close to the Right", close, () => {
|
|
13761
|
+
group.panels.filter((_, i) => i > index).forEach((p) => p.api.close());
|
|
13762
|
+
}, index === -1 || index >= group.panels.length - 1);
|
|
13763
|
+
}
|
|
13764
|
+
case "maximize": return this.buildMaximizeItem(panel, close);
|
|
13765
|
+
case "float": return buildItem("Float", close, () => this.accessor.api.addFloatingGroup(panel), panel.api.location.type === "floating");
|
|
13766
|
+
case "popout": return buildItem("Open in New Window", close, () => {
|
|
13767
|
+
this.accessor.api.addPopoutGroup(panel);
|
|
13768
|
+
}, panel.api.location.type === "popout");
|
|
13769
|
+
case "pin": return buildItem(panel.api.isPinned ? "Unpin tab" : "Pin tab", close, () => panel.api.setPinned(!panel.api.isPinned));
|
|
13770
|
+
default: return;
|
|
13771
|
+
}
|
|
13772
|
+
}
|
|
13773
|
+
/**
|
|
13774
|
+
* Append one app-supplied item. A raw `element` is used as-is, a
|
|
13775
|
+
* `component` goes through the framework renderer, and a `label` builds the
|
|
13776
|
+
* default row; an item carrying none of the three renders nothing. Shared
|
|
13777
|
+
* by both menus, which differ only in `identity`.
|
|
13778
|
+
*/
|
|
13779
|
+
appendConfigItem(menuEl, item, identity, group, close) {
|
|
13780
|
+
if (item.element) menuEl.appendChild(item.element);
|
|
13781
|
+
else if (item.component) this.appendComponentItem(menuEl, item, identity, group, close);
|
|
13782
|
+
else if (item.label) menuEl.appendChild(buildItem(item.label, close, () => {
|
|
13783
|
+
var _item$action;
|
|
13784
|
+
return (_item$action = item.action) === null || _item$action === void 0 ? void 0 : _item$action.call(item);
|
|
13785
|
+
}, item.disabled));
|
|
13786
|
+
}
|
|
13787
|
+
show(panel, group, event) {
|
|
13788
|
+
const items = this._resolveTabItems(panel, group, event);
|
|
13789
|
+
if (items.length === 0) return;
|
|
13790
|
+
event.preventDefault();
|
|
13791
|
+
const popupService = this.accessor.getPopupServiceForGroup(group);
|
|
13792
|
+
const close = () => popupService.close();
|
|
13793
|
+
const menuEl = document.createElement("div");
|
|
13794
|
+
menuEl.className = "dv-context-menu";
|
|
13795
|
+
menuEl.setAttribute("role", "menu");
|
|
13796
|
+
for (const item of items) {
|
|
13797
|
+
if (isItemConfig(item)) {
|
|
13798
|
+
this.appendConfigItem(menuEl, item, { panel }, group, close);
|
|
13799
|
+
continue;
|
|
13800
|
+
}
|
|
13801
|
+
const el = this.buildBuiltInTabItem(item, panel, group, close);
|
|
13802
|
+
if (el) menuEl.appendChild(el);
|
|
13803
|
+
}
|
|
13804
|
+
popupService.openPopover(menuEl, {
|
|
13805
|
+
x: event.clientX,
|
|
13806
|
+
y: event.clientY,
|
|
13807
|
+
zIndex: popoverZIndexFor(event.target, group)
|
|
13808
|
+
});
|
|
13809
|
+
}
|
|
13810
|
+
showForChip(tabGroup, group, event) {
|
|
13811
|
+
if (!this.accessor.options.getTabGroupChipContextMenuItems) return;
|
|
13812
|
+
const items = this.accessor.options.getTabGroupChipContextMenuItems({
|
|
13813
|
+
tabGroup,
|
|
13814
|
+
group,
|
|
13815
|
+
api: this.accessor.api,
|
|
13816
|
+
event
|
|
13817
|
+
});
|
|
13818
|
+
if (items.length === 0) return;
|
|
13819
|
+
event.preventDefault();
|
|
13820
|
+
const popupService = this.accessor.getPopupServiceForGroup(group);
|
|
13821
|
+
const close = () => popupService.close();
|
|
13822
|
+
const menuEl = document.createElement("div");
|
|
13823
|
+
menuEl.className = "dv-context-menu";
|
|
13824
|
+
menuEl.setAttribute("role", "menu");
|
|
13825
|
+
for (const item of items) if (item === "separator") menuEl.appendChild(buildSeparator());
|
|
13826
|
+
else if (item === "rename") menuEl.appendChild(buildRenameInput(tabGroup));
|
|
13827
|
+
else if (item === "colorPicker") menuEl.appendChild(buildColorPicker(tabGroup, this.accessor.tabGroupColorPalette));
|
|
13828
|
+
else if (item === "collapse") menuEl.appendChild(this.buildCollapseItem(tabGroup, close));
|
|
13829
|
+
else if (item === "close") menuEl.appendChild(buildItem("Close All", close, () => {
|
|
13830
|
+
group.panels.filter((p) => tabGroup.containsPanel(p.id)).forEach((p) => p.api.close());
|
|
13831
|
+
}));
|
|
13832
|
+
else if (isItemConfig(item)) this.appendConfigItem(menuEl, item, { tabGroup }, group, close);
|
|
13833
|
+
popupService.openPopover(menuEl, {
|
|
13834
|
+
x: event.clientX,
|
|
13835
|
+
y: event.clientY,
|
|
13836
|
+
zIndex: popoverZIndexFor(event.target, group)
|
|
13837
|
+
});
|
|
13838
|
+
}
|
|
13839
|
+
};
|
|
13840
|
+
const ContextMenuModule = defineModule({
|
|
13841
|
+
name: "ContextMenu",
|
|
13842
|
+
serviceKey: "contextMenuService",
|
|
13843
|
+
create: (host) => new ContextMenuController(host)
|
|
13844
|
+
});
|
|
13845
|
+
|
|
13573
13846
|
//#endregion
|
|
13574
13847
|
//#region src/dockview/allModules.ts
|
|
13575
13848
|
/**
|
|
@@ -13587,7 +13860,8 @@ const AllModules = [
|
|
|
13587
13860
|
HeaderActionsModule,
|
|
13588
13861
|
LiveRegionModule,
|
|
13589
13862
|
AdvancedDnDModule,
|
|
13590
|
-
TabGroupChipsModule
|
|
13863
|
+
TabGroupChipsModule,
|
|
13864
|
+
ContextMenuModule
|
|
13591
13865
|
];
|
|
13592
13866
|
|
|
13593
13867
|
//#endregion
|
|
@@ -14279,6 +14553,14 @@ var PopupService = class extends CompositeDisposable {
|
|
|
14279
14553
|
//#endregion
|
|
14280
14554
|
//#region src/dnd/dropTargetAnchorContainer.ts
|
|
14281
14555
|
var DropTargetAnchorContainer = class extends CompositeDisposable {
|
|
14556
|
+
/**
|
|
14557
|
+
* The element the live overlay was rendered for, `undefined` when nothing
|
|
14558
|
+
* is showing. The container is shared by every drop target, so a caller
|
|
14559
|
+
* tearing down only its own overlay must check this before `clear()`.
|
|
14560
|
+
*/
|
|
14561
|
+
get renderedOutline() {
|
|
14562
|
+
return this._model ? this._outline : void 0;
|
|
14563
|
+
}
|
|
14282
14564
|
get disabled() {
|
|
14283
14565
|
return this._disabled;
|
|
14284
14566
|
}
|
|
@@ -14583,6 +14865,10 @@ var MiddleColumnView = class {
|
|
|
14583
14865
|
const index = position === "top" ? this._topIndex : this._bottomIndex;
|
|
14584
14866
|
if (index !== void 0) this._splitview.resizeView(index, size);
|
|
14585
14867
|
}
|
|
14868
|
+
/** The inner splitview's primary-axis (height) extent; zero until laid out. */
|
|
14869
|
+
get axisSize() {
|
|
14870
|
+
return this._splitview.size;
|
|
14871
|
+
}
|
|
14586
14872
|
updateMargin(gap) {
|
|
14587
14873
|
this._splitview.margin = gap;
|
|
14588
14874
|
}
|
|
@@ -14595,6 +14881,7 @@ var ShellManager = class {
|
|
|
14595
14881
|
constructor(container, dockviewElement, layoutGrid, gap = 0, defaultCollapsedSize = 35) {
|
|
14596
14882
|
this._disposables = new CompositeDisposable();
|
|
14597
14883
|
this._viewConfigs = /* @__PURE__ */ new Map();
|
|
14884
|
+
this._pendingSizes = /* @__PURE__ */ new Map();
|
|
14598
14885
|
this._currentWidth = 0;
|
|
14599
14886
|
this._currentHeight = 0;
|
|
14600
14887
|
this._gap = gap;
|
|
@@ -14685,11 +14972,13 @@ var ShellManager = class {
|
|
|
14685
14972
|
break;
|
|
14686
14973
|
}
|
|
14687
14974
|
this._disposables.addDisposables(view);
|
|
14975
|
+
if (!view.isCollapsed && !this._canResize(position)) this._pendingSizes.set(position, initialSize);
|
|
14688
14976
|
this.updateTheme(this._gap, this._defaultCollapsedSize);
|
|
14689
14977
|
return view;
|
|
14690
14978
|
}
|
|
14691
14979
|
layout(width, height) {
|
|
14692
14980
|
this._outerSplitview.layout(width, height);
|
|
14981
|
+
this._flushPendingSizes();
|
|
14693
14982
|
}
|
|
14694
14983
|
/**
|
|
14695
14984
|
* Called when the active theme changes. Updates splitview margins and
|
|
@@ -14753,6 +15042,7 @@ var ShellManager = class {
|
|
|
14753
15042
|
this._disposables.removeDisposable(view);
|
|
14754
15043
|
view.dispose();
|
|
14755
15044
|
this._viewConfigs.delete(position);
|
|
15045
|
+
this._pendingSizes.delete(position);
|
|
14756
15046
|
this.updateTheme(this._gap, this._defaultCollapsedSize);
|
|
14757
15047
|
}
|
|
14758
15048
|
hasEdgeGroup(position) {
|
|
@@ -14776,6 +15066,7 @@ var ShellManager = class {
|
|
|
14776
15066
|
this._middleColumn.setViewVisible(position, visible);
|
|
14777
15067
|
break;
|
|
14778
15068
|
}
|
|
15069
|
+
if (visible) this._flushPendingSizes();
|
|
14779
15070
|
}
|
|
14780
15071
|
isEdgeGroupVisible(position) {
|
|
14781
15072
|
switch (position) {
|
|
@@ -14793,20 +15084,63 @@ var ShellManager = class {
|
|
|
14793
15084
|
const view = this._getView(position);
|
|
14794
15085
|
if (!view) return;
|
|
14795
15086
|
view.setCollapsed(collapsed);
|
|
14796
|
-
|
|
15087
|
+
if (collapsed) {
|
|
15088
|
+
this._pendingSizes.delete(position);
|
|
15089
|
+
this._resizeView(position, view.collapsedSize);
|
|
15090
|
+
} else this.resizeEdgeGroup(position, view.lastExpandedSize);
|
|
15091
|
+
}
|
|
15092
|
+
/**
|
|
15093
|
+
* Resize the edge group at `position` along its primary axis (width for
|
|
15094
|
+
* `left`/`right`, height for `top`/`bottom`), clamped by the group's
|
|
15095
|
+
* constraints and the space available. Where `groupApi.setSize` lands.
|
|
15096
|
+
*
|
|
15097
|
+
* The size becomes the group's expanded size, so a collapsed group keeps
|
|
15098
|
+
* its strip and takes it on expand, and it survives a `toJSON` round-trip.
|
|
15099
|
+
*/
|
|
15100
|
+
resizeEdgeGroup(position, size) {
|
|
15101
|
+
const view = this._getView(position);
|
|
15102
|
+
if (!view || !Number.isFinite(size)) return;
|
|
15103
|
+
const target = Math.round(size);
|
|
15104
|
+
if (target <= 0) return;
|
|
15105
|
+
view.restoreExpandedSize(target);
|
|
15106
|
+
if (view.isCollapsed) {
|
|
15107
|
+
this._pendingSizes.delete(position);
|
|
15108
|
+
return;
|
|
15109
|
+
}
|
|
15110
|
+
if (this._canResize(position)) {
|
|
15111
|
+
this._pendingSizes.delete(position);
|
|
15112
|
+
this._resizeView(position, target);
|
|
15113
|
+
} else this._pendingSizes.set(position, target);
|
|
15114
|
+
}
|
|
15115
|
+
/** A resize lands only on a visible view (a hidden one is pinned to zero)
|
|
15116
|
+
* whose splitview has extent to distribute. */
|
|
15117
|
+
_canResize(position) {
|
|
15118
|
+
if (!this.isEdgeGroupVisible(position)) return false;
|
|
15119
|
+
return (position === "left" || position === "right" ? this._outerSplitview.size : this._middleColumn.axisSize) > 0;
|
|
15120
|
+
}
|
|
15121
|
+
_resizeView(position, size) {
|
|
14797
15122
|
switch (position) {
|
|
14798
15123
|
case "left":
|
|
14799
|
-
if (this._leftIndex !== void 0) this._outerSplitview.resizeView(this._leftIndex,
|
|
15124
|
+
if (this._leftIndex !== void 0) this._outerSplitview.resizeView(this._leftIndex, size);
|
|
14800
15125
|
break;
|
|
14801
15126
|
case "right":
|
|
14802
|
-
if (this._rightIndex !== void 0) this._outerSplitview.resizeView(this._rightIndex,
|
|
15127
|
+
if (this._rightIndex !== void 0) this._outerSplitview.resizeView(this._rightIndex, size);
|
|
14803
15128
|
break;
|
|
14804
15129
|
case "top":
|
|
14805
15130
|
case "bottom":
|
|
14806
|
-
this._middleColumn.resizeView(position,
|
|
15131
|
+
this._middleColumn.resizeView(position, size);
|
|
14807
15132
|
break;
|
|
14808
15133
|
}
|
|
14809
15134
|
}
|
|
15135
|
+
_flushPendingSizes() {
|
|
15136
|
+
if (this._pendingSizes.size === 0) return;
|
|
15137
|
+
for (const [position, size] of this._pendingSizes) {
|
|
15138
|
+
const view = this._getView(position);
|
|
15139
|
+
if (!view || view.isCollapsed || !this._canResize(position)) continue;
|
|
15140
|
+
this._pendingSizes.delete(position);
|
|
15141
|
+
this._resizeView(position, size);
|
|
15142
|
+
}
|
|
15143
|
+
}
|
|
14810
15144
|
isEdgeGroupCollapsed(position) {
|
|
14811
15145
|
var _this$_getView$isColl, _this$_getView;
|
|
14812
15146
|
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;
|
|
@@ -14832,15 +15166,17 @@ var ShellManager = class {
|
|
|
14832
15166
|
maximumSize: Number.isFinite(view.configuredMaximumSize) ? view.configuredMaximumSize : void 0,
|
|
14833
15167
|
collapsedSize: view.configuredCollapsedSize
|
|
14834
15168
|
});
|
|
14835
|
-
const expandedSize = (view, isVisible, liveSize, cachedVisibleSize) => {
|
|
15169
|
+
const expandedSize = (view, position, isVisible, liveSize, cachedVisibleSize) => {
|
|
14836
15170
|
if (view.isCollapsed) return view.lastExpandedSize;
|
|
15171
|
+
const pending = this._pendingSizes.get(position);
|
|
15172
|
+
if (pending !== void 0) return pending;
|
|
14837
15173
|
if (!isVisible) return cachedVisibleSize !== null && cachedVisibleSize !== void 0 ? cachedVisibleSize : view.lastExpandedSize;
|
|
14838
15174
|
return liveSize;
|
|
14839
15175
|
};
|
|
14840
15176
|
if (this._leftView && this._leftIndex !== void 0) {
|
|
14841
15177
|
const visible = this._outerSplitview.isViewVisible(this._leftIndex);
|
|
14842
15178
|
edgeGroups.left = _objectSpread2({
|
|
14843
|
-
size: expandedSize(this._leftView, visible, this._outerSplitview.getViewSize(this._leftIndex), this._outerSplitview.getViewCachedVisibleSize(this._leftIndex)),
|
|
15179
|
+
size: expandedSize(this._leftView, "left", visible, this._outerSplitview.getViewSize(this._leftIndex), this._outerSplitview.getViewCachedVisibleSize(this._leftIndex)),
|
|
14844
15180
|
visible,
|
|
14845
15181
|
collapsed: this._leftView.isCollapsed || void 0
|
|
14846
15182
|
}, constraints(this._leftView));
|
|
@@ -14848,7 +15184,7 @@ var ShellManager = class {
|
|
|
14848
15184
|
if (this._rightView && this._rightIndex !== void 0) {
|
|
14849
15185
|
const visible = this._outerSplitview.isViewVisible(this._rightIndex);
|
|
14850
15186
|
edgeGroups.right = _objectSpread2({
|
|
14851
|
-
size: expandedSize(this._rightView, visible, this._outerSplitview.getViewSize(this._rightIndex), this._outerSplitview.getViewCachedVisibleSize(this._rightIndex)),
|
|
15187
|
+
size: expandedSize(this._rightView, "right", visible, this._outerSplitview.getViewSize(this._rightIndex), this._outerSplitview.getViewCachedVisibleSize(this._rightIndex)),
|
|
14852
15188
|
visible,
|
|
14853
15189
|
collapsed: this._rightView.isCollapsed || void 0
|
|
14854
15190
|
}, constraints(this._rightView));
|
|
@@ -14856,7 +15192,7 @@ var ShellManager = class {
|
|
|
14856
15192
|
if (this._topView) {
|
|
14857
15193
|
const visible = this._middleColumn.isViewVisible("top");
|
|
14858
15194
|
edgeGroups.top = _objectSpread2({
|
|
14859
|
-
size: expandedSize(this._topView, visible, this._middleColumn.getViewSize("top"), this._middleColumn.getViewCachedVisibleSize("top")),
|
|
15195
|
+
size: expandedSize(this._topView, "top", visible, this._middleColumn.getViewSize("top"), this._middleColumn.getViewCachedVisibleSize("top")),
|
|
14860
15196
|
visible,
|
|
14861
15197
|
collapsed: this._topView.isCollapsed || void 0
|
|
14862
15198
|
}, constraints(this._topView));
|
|
@@ -14864,7 +15200,7 @@ var ShellManager = class {
|
|
|
14864
15200
|
if (this._bottomView) {
|
|
14865
15201
|
const visible = this._middleColumn.isViewVisible("bottom");
|
|
14866
15202
|
edgeGroups.bottom = _objectSpread2({
|
|
14867
|
-
size: expandedSize(this._bottomView, visible, this._middleColumn.getViewSize("bottom"), this._middleColumn.getViewCachedVisibleSize("bottom")),
|
|
15203
|
+
size: expandedSize(this._bottomView, "bottom", visible, this._middleColumn.getViewSize("bottom"), this._middleColumn.getViewCachedVisibleSize("bottom")),
|
|
14868
15204
|
visible,
|
|
14869
15205
|
collapsed: this._bottomView.isCollapsed || void 0
|
|
14870
15206
|
}, constraints(this._bottomView));
|
|
@@ -14872,33 +15208,23 @@ var ShellManager = class {
|
|
|
14872
15208
|
return edgeGroups;
|
|
14873
15209
|
}
|
|
14874
15210
|
fromJSON(data) {
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
|
|
14879
|
-
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
(
|
|
14885
|
-
|
|
14886
|
-
|
|
14887
|
-
if (
|
|
14888
|
-
|
|
14889
|
-
|
|
14890
|
-
|
|
14891
|
-
|
|
14892
|
-
(_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);
|
|
14893
|
-
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);
|
|
14894
|
-
if (!data.top.visible) this._middleColumn.setViewVisible("top", false);
|
|
14895
|
-
}
|
|
14896
|
-
if (data.bottom) {
|
|
14897
|
-
var _this$_bottomView2, _this$_bottomView3, _data$bottom$collapse, _this$_bottomView$col, _this$_bottomView4;
|
|
14898
|
-
(_this$_bottomView2 = this._bottomView) === null || _this$_bottomView2 === void 0 || _this$_bottomView2.restoreExpandedSize(data.bottom.size);
|
|
14899
|
-
(_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);
|
|
14900
|
-
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);
|
|
14901
|
-
if (!data.bottom.visible) this._middleColumn.setViewVisible("bottom", false);
|
|
15211
|
+
for (const position of [
|
|
15212
|
+
"left",
|
|
15213
|
+
"right",
|
|
15214
|
+
"top",
|
|
15215
|
+
"bottom"
|
|
15216
|
+
]) {
|
|
15217
|
+
var _state$collapsed;
|
|
15218
|
+
const state = data[position];
|
|
15219
|
+
const view = this._getView(position);
|
|
15220
|
+
if (!state || !view) continue;
|
|
15221
|
+
view.restoreExpandedSize(state.size);
|
|
15222
|
+
view.setCollapsed((_state$collapsed = state.collapsed) !== null && _state$collapsed !== void 0 ? _state$collapsed : false);
|
|
15223
|
+
if (state.collapsed) {
|
|
15224
|
+
this._pendingSizes.delete(position);
|
|
15225
|
+
this._resizeView(position, view.collapsedSize);
|
|
15226
|
+
} else this.resizeEdgeGroup(position, state.size);
|
|
15227
|
+
this.setEdgeGroupVisible(position, !!state.visible);
|
|
14902
15228
|
}
|
|
14903
15229
|
}
|
|
14904
15230
|
dispose() {
|
|
@@ -16283,6 +16609,13 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
16283
16609
|
position
|
|
16284
16610
|
};
|
|
16285
16611
|
group.model.headerPosition = position;
|
|
16612
|
+
const resizeDisposable = group.onDidChange((event) => {
|
|
16613
|
+
var _this$_shellManager3;
|
|
16614
|
+
if (!event) return;
|
|
16615
|
+
const size = position === "left" || position === "right" ? event.width : event.height;
|
|
16616
|
+
if (typeof size !== "number") return;
|
|
16617
|
+
(_this$_shellManager3 = this._shellManager) === null || _this$_shellManager3 === void 0 || _this$_shellManager3.resizeEdgeGroup(position, size);
|
|
16618
|
+
});
|
|
16286
16619
|
const autoCollapseDisposable = group.model.onDidRemovePanel(() => {
|
|
16287
16620
|
if (!group.model.isEmpty) return;
|
|
16288
16621
|
if (service.isAutoReveal(group)) queueMicrotask(() => {
|
|
@@ -16291,7 +16624,7 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
16291
16624
|
});
|
|
16292
16625
|
else this.setEdgeGroupCollapsed(group, true);
|
|
16293
16626
|
});
|
|
16294
|
-
service.add(position, group, autoCollapseDisposable);
|
|
16627
|
+
service.add(position, group, new CompositeDisposable(autoCollapseDisposable, resizeDisposable));
|
|
16295
16628
|
if (options.autoHide !== void 0) service.setAutoHide(group, options.autoHide);
|
|
16296
16629
|
if (options.autoReveal !== void 0) service.setAutoReveal(group, options.autoReveal);
|
|
16297
16630
|
this._onDidAddGroup.fire(group);
|
|
@@ -16386,8 +16719,8 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
16386
16719
|
}
|
|
16387
16720
|
/** The size an edge group expands to (pre-collapse); sizes the peek. */
|
|
16388
16721
|
getEdgeGroupExpandedSize(position) {
|
|
16389
|
-
var _this$_shellManager$g, _this$
|
|
16390
|
-
return (_this$_shellManager$g = (_this$
|
|
16722
|
+
var _this$_shellManager$g, _this$_shellManager4;
|
|
16723
|
+
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;
|
|
16391
16724
|
}
|
|
16392
16725
|
/** Reposition a single `renderer:'always'` panel's overlay over its
|
|
16393
16726
|
* reference container, optionally forcing it visible (the auto-hide peek
|
|
@@ -17548,7 +17881,7 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
17548
17881
|
}));
|
|
17549
17882
|
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
17550
17883
|
const updatedTargetLocation = getRelativeLocation(destinationGridview.orientation, getGridLocation(destinationGroup.element), destinationTarget);
|
|
17551
|
-
const newGroup = this.createGroupAtLocation(updatedTargetLocation,
|
|
17884
|
+
const newGroup = this.createGroupAtLocation(updatedTargetLocation, this.dropSizing(getGridLocation(destinationGroup.element)), void 0, destinationGridview);
|
|
17552
17885
|
this.movingLock(() => newGroup.model.openPanel(removedPanel, { skipSetActive: true }));
|
|
17553
17886
|
this.doSetGroupAndPanelActive(newGroup);
|
|
17554
17887
|
this.fireDidMovePanel(this.getGroupPanel(sourceItemId), sourceGroup);
|
|
@@ -17565,7 +17898,7 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
17565
17898
|
skipSetActiveGroup: true
|
|
17566
17899
|
}));
|
|
17567
17900
|
if (!removedPanel) throw new Error(`dockview: No panel with id ${sourceItemId}`);
|
|
17568
|
-
const newGroup = this.createGroupAtLocation(targetLocation,
|
|
17901
|
+
const newGroup = this.createGroupAtLocation(targetLocation, this.dropSizing(referenceLocation), void 0, destinationGridview);
|
|
17569
17902
|
this.movingLock(() => newGroup.model.openPanel(removedPanel, { skipSetGroupActive: true }));
|
|
17570
17903
|
this.doSetGroupAndPanelActive(newGroup);
|
|
17571
17904
|
this.fireDidMovePanel(removedPanel, sourceGroup);
|
|
@@ -17577,7 +17910,7 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
17577
17910
|
}));
|
|
17578
17911
|
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
17579
17912
|
const location = getRelativeLocation(destinationGridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
17580
|
-
this.movingLock(() => this.doAddGroup(targetGroup, location,
|
|
17913
|
+
this.movingLock(() => this.doAddGroup(targetGroup, location, this.dropSizing(updatedReferenceLocation), destinationGridview));
|
|
17581
17914
|
this.setGroupLocationForRoot(targetGroup, destinationGridview);
|
|
17582
17915
|
this.doSetGroupAndPanelActive(targetGroup);
|
|
17583
17916
|
this.fireDidMovePanel(this.getGroupPanel(sourceItemId), sourceGroup);
|
|
@@ -17592,7 +17925,7 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
17592
17925
|
}));
|
|
17593
17926
|
if (!removedPanel) throw new Error(`dockview: No panel with id ${sourceItemId}`);
|
|
17594
17927
|
const dropLocation = getRelativeLocation(destinationGridview.orientation, referenceLocation, destinationTarget);
|
|
17595
|
-
const group = this.createGroupAtLocation(dropLocation,
|
|
17928
|
+
const group = this.createGroupAtLocation(dropLocation, this.dropSizing(referenceLocation), void 0, destinationGridview);
|
|
17596
17929
|
this.movingLock(() => group.model.openPanel(removedPanel, { skipSetGroupActive: true }));
|
|
17597
17930
|
this.doSetGroupAndPanelActive(group);
|
|
17598
17931
|
this.fireDidMovePanel(removedPanel, sourceGroup);
|
|
@@ -17636,7 +17969,7 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
17636
17969
|
if (!destinationTarget || destinationTarget === "center" || !referenceLocation) targetGroup = destinationGroup;
|
|
17637
17970
|
else {
|
|
17638
17971
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
17639
|
-
targetGroup = this.createGroupAtLocation(dropLocation);
|
|
17972
|
+
targetGroup = this.createGroupAtLocation(dropLocation, this.dropSizing(referenceLocation));
|
|
17640
17973
|
}
|
|
17641
17974
|
if (!options.keepEmptyGroups && sourceGroup.model.size === 0 && sourceGroup !== targetGroup) this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
17642
17975
|
addPanelsToGroup(targetGroup);
|
|
@@ -17687,6 +18020,21 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
17687
18020
|
if (options.skipSetActive !== true) this.doSetGroupAndPanelActive(to);
|
|
17688
18021
|
else if (!this.activePanel) this.doSetGroupAndPanelActive(to);
|
|
17689
18022
|
} else {
|
|
18023
|
+
const isReorderWithinBranch = (() => {
|
|
18024
|
+
if (from.api.location.type === "edge" || to.api.location.type === "edge") return false;
|
|
18025
|
+
const root = this.getGridviewForGroup(from);
|
|
18026
|
+
if (root !== this.getGridviewForGroup(to)) return false;
|
|
18027
|
+
let fromLocation;
|
|
18028
|
+
let toLocation;
|
|
18029
|
+
try {
|
|
18030
|
+
fromLocation = getGridLocation(from.element);
|
|
18031
|
+
toLocation = getGridLocation(to.element);
|
|
18032
|
+
} catch (_unused) {
|
|
18033
|
+
return false;
|
|
18034
|
+
}
|
|
18035
|
+
if (fromLocation.length === 0 || toLocation.length === 0) return false;
|
|
18036
|
+
return sequenceEquals(tail(fromLocation)[0], tail(toLocation)[0]) && getLocationOrientation(root.orientation, toLocation) === getDirectionOrientation(target);
|
|
18037
|
+
})();
|
|
17690
18038
|
if (from.api.location.type === "edge") {
|
|
17691
18039
|
/**
|
|
17692
18040
|
* Edge groups are permanent structural elements and must
|
|
@@ -17752,13 +18100,10 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
17752
18100
|
const referenceLocation = getGridLocation(to.element);
|
|
17753
18101
|
const dropLocation = getRelativeLocation(destGridview.orientation, referenceLocation, target);
|
|
17754
18102
|
let size;
|
|
17755
|
-
|
|
17756
|
-
|
|
17757
|
-
|
|
17758
|
-
|
|
17759
|
-
case "HORIZONTAL":
|
|
17760
|
-
size = referenceLocation.length % 2 == 0 ? from.api.height : from.api.width;
|
|
17761
|
-
break;
|
|
18103
|
+
if (isReorderWithinBranch) size = getDirectionOrientation(target) === "HORIZONTAL" ? from.api.width : from.api.height;
|
|
18104
|
+
else {
|
|
18105
|
+
var _referenceLocation;
|
|
18106
|
+
size = Sizing.Split((_referenceLocation = referenceLocation[referenceLocation.length - 1]) !== null && _referenceLocation !== void 0 ? _referenceLocation : 0);
|
|
17762
18107
|
}
|
|
17763
18108
|
destGridview.addView(source, size, dropLocation);
|
|
17764
18109
|
this.setGroupLocationForRoot(source, destGridview);
|
|
@@ -17883,6 +18228,16 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
17883
18228
|
});
|
|
17884
18229
|
return panel;
|
|
17885
18230
|
}
|
|
18231
|
+
/**
|
|
18232
|
+
* Sizing for a group created by a drop next to `referenceLocation`: half
|
|
18233
|
+
* of the group the overlay was drawn over, leaving its siblings alone, so
|
|
18234
|
+
* the panel lands in the region the overlay indicated (#1612). Gridview
|
|
18235
|
+
* rewrites the index to 0 when a cross-axis drop wraps the reference in a
|
|
18236
|
+
* new branch, so one value serves both paths.
|
|
18237
|
+
*/
|
|
18238
|
+
dropSizing(referenceLocation) {
|
|
18239
|
+
return Sizing.Split(referenceLocation.length === 0 ? 0 : referenceLocation[referenceLocation.length - 1]);
|
|
18240
|
+
}
|
|
17886
18241
|
createGroupAtLocation(location, size, options, gridview = this.gridview) {
|
|
17887
18242
|
const group = this.createGroup(options);
|
|
17888
18243
|
this.doAddGroup(group, location, size, gridview);
|
|
@@ -17942,22 +18297,22 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
17942
18297
|
return location.length % 2 == 1 ? rootOrientation : orthogonal(rootOrientation);
|
|
17943
18298
|
}
|
|
17944
18299
|
updateTheme() {
|
|
17945
|
-
var _this$_options$theme, _this$_shellThemeClas, _theme$gap, _this$_popoutWindowSe23, _this$_popoutWindowSe24, _this$
|
|
18300
|
+
var _this$_options$theme, _this$_shellThemeClas, _theme$gap, _this$_popoutWindowSe23, _this$_popoutWindowSe24, _this$_shellManager5, _theme$edgeGroupColla, _theme$tabGroupIndica;
|
|
17946
18301
|
const theme = (_this$_options$theme = this._options.theme) !== null && _this$_options$theme !== void 0 ? _this$_options$theme : themeAbyss;
|
|
17947
18302
|
(_this$_shellThemeClas = this._shellThemeClassnames) === null || _this$_shellThemeClas === void 0 || _this$_shellThemeClas.setClassNames(theme.className);
|
|
17948
18303
|
const gap = (_theme$gap = theme.gap) !== null && _theme$gap !== void 0 ? _theme$gap : 0;
|
|
17949
18304
|
this.gridview.margin = gap;
|
|
17950
18305
|
for (const floating of this.floatingGroups) floating.gridview.margin = gap;
|
|
17951
18306
|
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;
|
|
17952
|
-
(_this$
|
|
18307
|
+
(_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);
|
|
17953
18308
|
if (theme.dndOverlayBorder === void 0) {
|
|
17954
|
-
var _this$
|
|
18309
|
+
var _this$_shellManager6;
|
|
17955
18310
|
this.element.style.removeProperty("--dv-drag-over-border");
|
|
17956
|
-
(_this$
|
|
18311
|
+
(_this$_shellManager6 = this._shellManager) === null || _this$_shellManager6 === void 0 || _this$_shellManager6.element.style.removeProperty("--dv-drag-over-border");
|
|
17957
18312
|
} else {
|
|
17958
|
-
var _this$
|
|
18313
|
+
var _this$_shellManager7;
|
|
17959
18314
|
this.element.style.setProperty("--dv-drag-over-border", theme.dndOverlayBorder);
|
|
17960
|
-
(_this$
|
|
18315
|
+
(_this$_shellManager7 = this._shellManager) === null || _this$_shellManager7 === void 0 || _this$_shellManager7.element.style.setProperty("--dv-drag-over-border", theme.dndOverlayBorder);
|
|
17961
18316
|
}
|
|
17962
18317
|
switch (theme.dndOverlayMounting) {
|
|
17963
18318
|
case "absolute":
|
|
@@ -18860,6 +19215,8 @@ exports.AdvancedDnDModule = AdvancedDnDModule;
|
|
|
18860
19215
|
exports.AdvancedDnDService = AdvancedDnDService;
|
|
18861
19216
|
exports.BaseGrid = BaseGrid;
|
|
18862
19217
|
exports.ContentContainer = ContentContainer;
|
|
19218
|
+
exports.ContextMenuController = ContextMenuController;
|
|
19219
|
+
exports.ContextMenuModule = ContextMenuModule;
|
|
18863
19220
|
exports.DEFAULT_TAB_GROUP_COLORS = DEFAULT_TAB_GROUP_COLORS;
|
|
18864
19221
|
exports.DefaultDockviewDeserialzier = DefaultDockviewDeserialzier;
|
|
18865
19222
|
exports.DefaultTab = DefaultTab;
|