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
|
@@ -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
|
*/
|
|
@@ -1055,8 +1055,14 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
1055
1055
|
container.appendChild(view.element);
|
|
1056
1056
|
let viewSize;
|
|
1057
1057
|
if (typeof size === "number") viewSize = size;
|
|
1058
|
-
else if (size.type === "split")
|
|
1059
|
-
|
|
1058
|
+
else if (size.type === "split") {
|
|
1059
|
+
const splitTarget = this.viewItems[size.index];
|
|
1060
|
+
if (splitTarget) {
|
|
1061
|
+
const half = Math.floor(splitTarget.size / 2);
|
|
1062
|
+
viewSize = splitTarget.size - half;
|
|
1063
|
+
splitTarget.size = half;
|
|
1064
|
+
} else viewSize = this.getViewSize(size.index) / 2;
|
|
1065
|
+
} else if (size.type === "invisible") viewSize = { cachedVisibleSize: size.cachedVisibleSize };
|
|
1060
1066
|
else viewSize = view.minimumSize;
|
|
1061
1067
|
const disposable = view.onDidChange((newSize) => this.onDidChange(viewItem, newSize.size));
|
|
1062
1068
|
const viewItem = new ViewItem(container, view, viewSize, { dispose: () => {
|
|
@@ -5801,7 +5807,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
5801
5807
|
};
|
|
5802
5808
|
case "auto":
|
|
5803
5809
|
case void 0:
|
|
5804
|
-
default: return isCoarsePrimaryInput$
|
|
5810
|
+
default: return isCoarsePrimaryInput$2() ? {
|
|
5805
5811
|
html5: false,
|
|
5806
5812
|
pointer: true,
|
|
5807
5813
|
pointerHandlesMouse: true
|
|
@@ -5812,7 +5818,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
5812
5818
|
};
|
|
5813
5819
|
}
|
|
5814
5820
|
}
|
|
5815
|
-
function isCoarsePrimaryInput$
|
|
5821
|
+
function isCoarsePrimaryInput$2() {
|
|
5816
5822
|
if (globalThis.window === void 0 || !globalThis.matchMedia) return false;
|
|
5817
5823
|
const coarse = globalThis.matchMedia("(pointer: coarse)").matches;
|
|
5818
5824
|
const fine = globalThis.matchMedia("(pointer: fine)").matches;
|
|
@@ -7967,11 +7973,28 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
7967
7973
|
if (this._voidContainer && related && (related === this._voidContainer || this._voidContainer.contains(related))) return;
|
|
7968
7974
|
this.resetTabTransforms();
|
|
7969
7975
|
if (this._animState.sourceIndex === -1) {
|
|
7970
|
-
|
|
7971
|
-
(_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();
|
|
7976
|
+
this.clearHeaderAnchorOverlay();
|
|
7972
7977
|
this._animState = null;
|
|
7973
7978
|
} else this._animState.currentInsertionIndex = null;
|
|
7974
7979
|
}
|
|
7980
|
+
/**
|
|
7981
|
+
* Clear the anchored overlay only when this header is what rendered it.
|
|
7982
|
+
* The container is shared with the group's content drop target, which
|
|
7983
|
+
* renders into it on the same frame the cursor leaves the strip: the
|
|
7984
|
+
* pointer backend calls `handleDragOver` on the new target before the
|
|
7985
|
+
* global `onDragMove` that reaches us (#1612).
|
|
7986
|
+
*/
|
|
7987
|
+
clearHeaderAnchorOverlay() {
|
|
7988
|
+
var _container$model;
|
|
7989
|
+
const container = this.group.model.dropTargetContainer;
|
|
7990
|
+
const outline = container === null || container === void 0 ? void 0 : container.renderedOutline;
|
|
7991
|
+
if (outline && ![
|
|
7992
|
+
this._tabsList,
|
|
7993
|
+
this._voidContainer,
|
|
7994
|
+
this._extendedDropZone
|
|
7995
|
+
].some((scope) => scope === null || scope === void 0 ? void 0 : scope.contains(outline))) return;
|
|
7996
|
+
container === null || container === void 0 || (_container$model = container.model) === null || _container$model === void 0 || _container$model.clear();
|
|
7997
|
+
}
|
|
7975
7998
|
handleDragOver(event) {
|
|
7976
7999
|
var _this$accessor$option2;
|
|
7977
8000
|
if (!this._animState) return;
|
|
@@ -12401,7 +12424,6 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
12401
12424
|
"AdvancedOverflow",
|
|
12402
12425
|
"AutoEdgeGroup",
|
|
12403
12426
|
"AutoHideEdgeGroup",
|
|
12404
|
-
"ContextMenu",
|
|
12405
12427
|
"DndCompass",
|
|
12406
12428
|
"KeyboardDocking",
|
|
12407
12429
|
"KeyboardNavigation",
|
|
@@ -12483,8 +12505,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
12483
12505
|
* case: calling `undo()` having never set the option at all.
|
|
12484
12506
|
*
|
|
12485
12507
|
* Interaction handlers are queries in this sense too: a right-click reaching an
|
|
12486
|
-
* absent
|
|
12487
|
-
*
|
|
12508
|
+
* absent module means the app never asked for that feature, so it stays silent
|
|
12509
|
+
* (`?.`) and the browser's own behaviour applies. Options are where intent is
|
|
12488
12510
|
* declared; see `optionsModules.ts`.
|
|
12489
12511
|
*/
|
|
12490
12512
|
function assertModule(service, moduleName, context) {
|
|
@@ -12564,10 +12586,9 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
12564
12586
|
*
|
|
12565
12587
|
* This is the "declared intent" diagnostic. It fires when the user asks for a
|
|
12566
12588
|
* feature via options, at construction and on every `updateOptions`. It
|
|
12567
|
-
* deliberately does *not* fire on user interaction:
|
|
12568
|
-
*
|
|
12569
|
-
*
|
|
12570
|
-
* app never wanted.
|
|
12589
|
+
* deliberately does *not* fire on user interaction: an interaction reaching an
|
|
12590
|
+
* absent module stays silent, because the `?.` service-slot call sites can't
|
|
12591
|
+
* tell a missing module from a feature the app never wanted.
|
|
12571
12592
|
*
|
|
12572
12593
|
* Rules are a flat list rather than a `Record<keyof DockviewOptions, ...>`
|
|
12573
12594
|
* because dockview's options are nested and value-gated: `overflow.mode:
|
|
@@ -12663,18 +12684,6 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
12663
12684
|
moduleName: "AutoEdgeGroup",
|
|
12664
12685
|
when: (o) => isAnyEdgeGroupEnabled(o.dockToEdgeGroups)
|
|
12665
12686
|
},
|
|
12666
|
-
{
|
|
12667
|
-
optionKey: "getTabContextMenuItems",
|
|
12668
|
-
reason: "getTabContextMenuItems",
|
|
12669
|
-
moduleName: "ContextMenu",
|
|
12670
|
-
when: (o) => o.getTabContextMenuItems != null
|
|
12671
|
-
},
|
|
12672
|
-
{
|
|
12673
|
-
optionKey: "getTabGroupChipContextMenuItems",
|
|
12674
|
-
reason: "getTabGroupChipContextMenuItems",
|
|
12675
|
-
moduleName: "ContextMenu",
|
|
12676
|
-
when: (o) => o.getTabGroupChipContextMenuItems != null
|
|
12677
|
-
},
|
|
12678
12687
|
{
|
|
12679
12688
|
optionKey: "dndCompass",
|
|
12680
12689
|
reason: "dndCompass",
|
|
@@ -13575,6 +13584,270 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
13575
13584
|
}
|
|
13576
13585
|
});
|
|
13577
13586
|
|
|
13587
|
+
//#endregion
|
|
13588
|
+
//#region src/dockview/contextMenuService.ts
|
|
13589
|
+
function popoverZIndexFor(target, group) {
|
|
13590
|
+
var _group$api, _group$api$isPeeking;
|
|
13591
|
+
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)";
|
|
13592
|
+
if (!(target instanceof HTMLElement)) return;
|
|
13593
|
+
const relativeParent = findRelativeZIndexParent(target);
|
|
13594
|
+
return (relativeParent === null || relativeParent === void 0 ? void 0 : relativeParent.style.zIndex) ? `calc(${relativeParent.style.zIndex} * 2)` : void 0;
|
|
13595
|
+
}
|
|
13596
|
+
let _nextId = 0;
|
|
13597
|
+
const nextContextMenuItemId = () => `dv-ctx-menu-item-${_nextId++}`;
|
|
13598
|
+
function isItemConfig(item) {
|
|
13599
|
+
return typeof item === "object";
|
|
13600
|
+
}
|
|
13601
|
+
function buildItem(label, close, action, disabled) {
|
|
13602
|
+
const el = document.createElement("div");
|
|
13603
|
+
el.className = "dv-context-menu-item";
|
|
13604
|
+
el.setAttribute("role", "menuitem");
|
|
13605
|
+
if (disabled) {
|
|
13606
|
+
el.classList.add("dv-context-menu-item--disabled");
|
|
13607
|
+
el.setAttribute("aria-disabled", "true");
|
|
13608
|
+
}
|
|
13609
|
+
el.textContent = label;
|
|
13610
|
+
if (!disabled) el.addEventListener("click", () => {
|
|
13611
|
+
action();
|
|
13612
|
+
close();
|
|
13613
|
+
});
|
|
13614
|
+
return el;
|
|
13615
|
+
}
|
|
13616
|
+
function buildSeparator() {
|
|
13617
|
+
const el = document.createElement("div");
|
|
13618
|
+
el.className = "dv-context-menu-separator";
|
|
13619
|
+
el.setAttribute("role", "separator");
|
|
13620
|
+
return el;
|
|
13621
|
+
}
|
|
13622
|
+
function isCoarsePrimaryInput$1() {
|
|
13623
|
+
if (globalThis.window === void 0 || !globalThis.matchMedia) return false;
|
|
13624
|
+
const coarse = globalThis.matchMedia("(pointer: coarse)").matches;
|
|
13625
|
+
const fine = globalThis.matchMedia("(pointer: fine)").matches;
|
|
13626
|
+
return coarse && !fine;
|
|
13627
|
+
}
|
|
13628
|
+
function buildRenameInput(tabGroup) {
|
|
13629
|
+
const wrapper = document.createElement("div");
|
|
13630
|
+
wrapper.className = "dv-context-menu-rename";
|
|
13631
|
+
const input = document.createElement("input");
|
|
13632
|
+
input.className = "dv-context-menu-rename-input";
|
|
13633
|
+
input.type = "text";
|
|
13634
|
+
input.placeholder = "Name This Group";
|
|
13635
|
+
input.value = tabGroup.label;
|
|
13636
|
+
input.addEventListener("input", () => {
|
|
13637
|
+
tabGroup.setLabel(input.value);
|
|
13638
|
+
});
|
|
13639
|
+
input.addEventListener("keydown", (e) => {
|
|
13640
|
+
if (e.key !== "Escape" && e.key !== "Enter") e.stopPropagation();
|
|
13641
|
+
});
|
|
13642
|
+
input.addEventListener("click", (e) => {
|
|
13643
|
+
e.stopPropagation();
|
|
13644
|
+
});
|
|
13645
|
+
wrapper.appendChild(input);
|
|
13646
|
+
if (!isCoarsePrimaryInput$1()) requestAnimationFrame(() => {
|
|
13647
|
+
input.focus();
|
|
13648
|
+
input.select();
|
|
13649
|
+
});
|
|
13650
|
+
return wrapper;
|
|
13651
|
+
}
|
|
13652
|
+
function buildColorPicker(tabGroup, palette) {
|
|
13653
|
+
const wrapper = document.createElement("div");
|
|
13654
|
+
wrapper.className = "dv-context-menu-color-picker";
|
|
13655
|
+
if (!palette.enabled) return wrapper;
|
|
13656
|
+
for (const entry of palette.entries()) {
|
|
13657
|
+
const swatch = document.createElement("div");
|
|
13658
|
+
swatch.className = "dv-context-menu-color-swatch";
|
|
13659
|
+
swatch.style.setProperty("--dv-tab-group-color", entry.value);
|
|
13660
|
+
if (entry.label) swatch.title = entry.label;
|
|
13661
|
+
if (tabGroup.color === entry.id) swatch.classList.add("dv-context-menu-color-swatch--selected");
|
|
13662
|
+
swatch.addEventListener("click", () => {
|
|
13663
|
+
tabGroup.setColor(entry.id);
|
|
13664
|
+
});
|
|
13665
|
+
wrapper.appendChild(swatch);
|
|
13666
|
+
}
|
|
13667
|
+
return wrapper;
|
|
13668
|
+
}
|
|
13669
|
+
var ContextMenuController = class {
|
|
13670
|
+
constructor(accessor) {
|
|
13671
|
+
this.accessor = accessor;
|
|
13672
|
+
}
|
|
13673
|
+
/**
|
|
13674
|
+
* A single maximize/restore toggle whose label and behaviour track the
|
|
13675
|
+
* group's live state: it reads *Restore* + calls `exitMaximized` when the
|
|
13676
|
+
* group is maximized, otherwise *Maximize* + `maximize`. Only grid groups
|
|
13677
|
+
* can be maximized, so the item is disabled for floating / popout panels
|
|
13678
|
+
* that are not already maximized.
|
|
13679
|
+
*/
|
|
13680
|
+
buildMaximizeItem(panel, close) {
|
|
13681
|
+
const isMaximized = panel.api.isMaximized();
|
|
13682
|
+
return buildItem(isMaximized ? "Restore" : "Maximize", close, isMaximized ? () => panel.api.exitMaximized() : () => panel.api.maximize(), !isMaximized && panel.api.location.type !== "grid");
|
|
13683
|
+
}
|
|
13684
|
+
/**
|
|
13685
|
+
* A single collapse/expand toggle whose label tracks the tab group's live
|
|
13686
|
+
* state: *Expand* when the group is already collapsed, otherwise *Collapse*.
|
|
13687
|
+
*/
|
|
13688
|
+
buildCollapseItem(tabGroup, close) {
|
|
13689
|
+
return buildItem(tabGroup.collapsed ? "Expand" : "Collapse", close, () => tabGroup.toggle());
|
|
13690
|
+
}
|
|
13691
|
+
/**
|
|
13692
|
+
* Whether to auto-inject the built-in Pin/Unpin item at the top of the tab
|
|
13693
|
+
* menu. True only when the PinnedTabs module is registered, pinning is
|
|
13694
|
+
* enabled, and the app has not opted out via `pinnedTabs.contextMenuItem:
|
|
13695
|
+
* false` (the item is on by default). This keeps pinning reachable from the
|
|
13696
|
+
* menu without the app having to return `'pin'` from
|
|
13697
|
+
* `getTabContextMenuItems` itself.
|
|
13698
|
+
*/
|
|
13699
|
+
_shouldInjectPin() {
|
|
13700
|
+
const pinnedTabs = this.accessor.options.pinnedTabs;
|
|
13701
|
+
return !!this.accessor.pinnedTabsService && !!(pinnedTabs === null || pinnedTabs === void 0 ? void 0 : pinnedTabs.enabled) && pinnedTabs.contextMenuItem !== false;
|
|
13702
|
+
}
|
|
13703
|
+
/**
|
|
13704
|
+
* The tab menu items: the app's own items (if any) with the built-in
|
|
13705
|
+
* `'pin'` item prepended when {@link _shouldInjectPin} applies, so the app
|
|
13706
|
+
* keeps full control of its list, and pinning is added without disturbing
|
|
13707
|
+
* it. Reuses the existing `'pin'` token rendering below.
|
|
13708
|
+
*/
|
|
13709
|
+
_resolveTabItems(panel, group, event) {
|
|
13710
|
+
var _this$accessor$option, _this$accessor$option2, _this$accessor$option3;
|
|
13711
|
+
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, {
|
|
13712
|
+
panel,
|
|
13713
|
+
group,
|
|
13714
|
+
api: this.accessor.api,
|
|
13715
|
+
event
|
|
13716
|
+
})) !== null && _this$accessor$option !== void 0 ? _this$accessor$option : [];
|
|
13717
|
+
return this._shouldInjectPin() ? ["pin", ...appItems] : appItems;
|
|
13718
|
+
}
|
|
13719
|
+
/**
|
|
13720
|
+
* Render a custom `component` menu item and append it to `menuEl`. Builds
|
|
13721
|
+
* the framework renderer via the host's `createContextMenuItemComponent`
|
|
13722
|
+
* factory and initialises it. Shared by the tab menu and the chip menu,
|
|
13723
|
+
* which differ only in `identity`: the tab menu passes the `panel`, the chip
|
|
13724
|
+
* menu passes the `tabGroup`. No-op when no renderer could be created (no
|
|
13725
|
+
* factory configured, or the factory declined the component).
|
|
13726
|
+
*/
|
|
13727
|
+
appendComponentItem(menuEl, item, identity, group, close) {
|
|
13728
|
+
var _this$accessor$option4, _this$accessor$option5;
|
|
13729
|
+
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, {
|
|
13730
|
+
id: nextContextMenuItemId(),
|
|
13731
|
+
component: item.component
|
|
13732
|
+
});
|
|
13733
|
+
if (!renderer) return;
|
|
13734
|
+
renderer.init(_objectSpread2(_objectSpread2({}, identity), {}, {
|
|
13735
|
+
group,
|
|
13736
|
+
api: this.accessor.api,
|
|
13737
|
+
close,
|
|
13738
|
+
componentProps: item.componentProps
|
|
13739
|
+
}));
|
|
13740
|
+
menuEl.appendChild(renderer.element);
|
|
13741
|
+
}
|
|
13742
|
+
/**
|
|
13743
|
+
* The element for one built-in tab item, or `undefined` for a token this
|
|
13744
|
+
* version doesn't know (an app on a newer typings version, or plain JS):
|
|
13745
|
+
* an unrecognised token renders nothing rather than throwing.
|
|
13746
|
+
*/
|
|
13747
|
+
buildBuiltInTabItem(item, panel, group, close) {
|
|
13748
|
+
switch (item) {
|
|
13749
|
+
case "separator": return buildSeparator();
|
|
13750
|
+
case "close": return buildItem("Close", close, () => panel.api.close());
|
|
13751
|
+
case "closeOthers": return buildItem("Close Others", close, () => {
|
|
13752
|
+
group.panels.filter((p) => p !== panel).forEach((p) => p.api.close());
|
|
13753
|
+
});
|
|
13754
|
+
case "closeAll": return buildItem("Close All", close, () => {
|
|
13755
|
+
[...group.panels].forEach((p) => p.api.close());
|
|
13756
|
+
});
|
|
13757
|
+
case "closeLeft": {
|
|
13758
|
+
const index = group.panels.indexOf(panel);
|
|
13759
|
+
return buildItem("Close to the Left", close, () => {
|
|
13760
|
+
group.panels.filter((_, i) => i < index).forEach((p) => p.api.close());
|
|
13761
|
+
}, index <= 0);
|
|
13762
|
+
}
|
|
13763
|
+
case "closeRight": {
|
|
13764
|
+
const index = group.panels.indexOf(panel);
|
|
13765
|
+
return buildItem("Close to the Right", close, () => {
|
|
13766
|
+
group.panels.filter((_, i) => i > index).forEach((p) => p.api.close());
|
|
13767
|
+
}, index === -1 || index >= group.panels.length - 1);
|
|
13768
|
+
}
|
|
13769
|
+
case "maximize": return this.buildMaximizeItem(panel, close);
|
|
13770
|
+
case "float": return buildItem("Float", close, () => this.accessor.api.addFloatingGroup(panel), panel.api.location.type === "floating");
|
|
13771
|
+
case "popout": return buildItem("Open in New Window", close, () => {
|
|
13772
|
+
this.accessor.api.addPopoutGroup(panel);
|
|
13773
|
+
}, panel.api.location.type === "popout");
|
|
13774
|
+
case "pin": return buildItem(panel.api.isPinned ? "Unpin tab" : "Pin tab", close, () => panel.api.setPinned(!panel.api.isPinned));
|
|
13775
|
+
default: return;
|
|
13776
|
+
}
|
|
13777
|
+
}
|
|
13778
|
+
/**
|
|
13779
|
+
* Append one app-supplied item. A raw `element` is used as-is, a
|
|
13780
|
+
* `component` goes through the framework renderer, and a `label` builds the
|
|
13781
|
+
* default row; an item carrying none of the three renders nothing. Shared
|
|
13782
|
+
* by both menus, which differ only in `identity`.
|
|
13783
|
+
*/
|
|
13784
|
+
appendConfigItem(menuEl, item, identity, group, close) {
|
|
13785
|
+
if (item.element) menuEl.appendChild(item.element);
|
|
13786
|
+
else if (item.component) this.appendComponentItem(menuEl, item, identity, group, close);
|
|
13787
|
+
else if (item.label) menuEl.appendChild(buildItem(item.label, close, () => {
|
|
13788
|
+
var _item$action;
|
|
13789
|
+
return (_item$action = item.action) === null || _item$action === void 0 ? void 0 : _item$action.call(item);
|
|
13790
|
+
}, item.disabled));
|
|
13791
|
+
}
|
|
13792
|
+
show(panel, group, event) {
|
|
13793
|
+
const items = this._resolveTabItems(panel, group, event);
|
|
13794
|
+
if (items.length === 0) return;
|
|
13795
|
+
event.preventDefault();
|
|
13796
|
+
const popupService = this.accessor.getPopupServiceForGroup(group);
|
|
13797
|
+
const close = () => popupService.close();
|
|
13798
|
+
const menuEl = document.createElement("div");
|
|
13799
|
+
menuEl.className = "dv-context-menu";
|
|
13800
|
+
menuEl.setAttribute("role", "menu");
|
|
13801
|
+
for (const item of items) {
|
|
13802
|
+
if (isItemConfig(item)) {
|
|
13803
|
+
this.appendConfigItem(menuEl, item, { panel }, group, close);
|
|
13804
|
+
continue;
|
|
13805
|
+
}
|
|
13806
|
+
const el = this.buildBuiltInTabItem(item, panel, group, close);
|
|
13807
|
+
if (el) menuEl.appendChild(el);
|
|
13808
|
+
}
|
|
13809
|
+
popupService.openPopover(menuEl, {
|
|
13810
|
+
x: event.clientX,
|
|
13811
|
+
y: event.clientY,
|
|
13812
|
+
zIndex: popoverZIndexFor(event.target, group)
|
|
13813
|
+
});
|
|
13814
|
+
}
|
|
13815
|
+
showForChip(tabGroup, group, event) {
|
|
13816
|
+
if (!this.accessor.options.getTabGroupChipContextMenuItems) return;
|
|
13817
|
+
const items = this.accessor.options.getTabGroupChipContextMenuItems({
|
|
13818
|
+
tabGroup,
|
|
13819
|
+
group,
|
|
13820
|
+
api: this.accessor.api,
|
|
13821
|
+
event
|
|
13822
|
+
});
|
|
13823
|
+
if (items.length === 0) return;
|
|
13824
|
+
event.preventDefault();
|
|
13825
|
+
const popupService = this.accessor.getPopupServiceForGroup(group);
|
|
13826
|
+
const close = () => popupService.close();
|
|
13827
|
+
const menuEl = document.createElement("div");
|
|
13828
|
+
menuEl.className = "dv-context-menu";
|
|
13829
|
+
menuEl.setAttribute("role", "menu");
|
|
13830
|
+
for (const item of items) if (item === "separator") menuEl.appendChild(buildSeparator());
|
|
13831
|
+
else if (item === "rename") menuEl.appendChild(buildRenameInput(tabGroup));
|
|
13832
|
+
else if (item === "colorPicker") menuEl.appendChild(buildColorPicker(tabGroup, this.accessor.tabGroupColorPalette));
|
|
13833
|
+
else if (item === "collapse") menuEl.appendChild(this.buildCollapseItem(tabGroup, close));
|
|
13834
|
+
else if (item === "close") menuEl.appendChild(buildItem("Close All", close, () => {
|
|
13835
|
+
group.panels.filter((p) => tabGroup.containsPanel(p.id)).forEach((p) => p.api.close());
|
|
13836
|
+
}));
|
|
13837
|
+
else if (isItemConfig(item)) this.appendConfigItem(menuEl, item, { tabGroup }, group, close);
|
|
13838
|
+
popupService.openPopover(menuEl, {
|
|
13839
|
+
x: event.clientX,
|
|
13840
|
+
y: event.clientY,
|
|
13841
|
+
zIndex: popoverZIndexFor(event.target, group)
|
|
13842
|
+
});
|
|
13843
|
+
}
|
|
13844
|
+
};
|
|
13845
|
+
const ContextMenuModule = defineModule({
|
|
13846
|
+
name: "ContextMenu",
|
|
13847
|
+
serviceKey: "contextMenuService",
|
|
13848
|
+
create: (host) => new ContextMenuController(host)
|
|
13849
|
+
});
|
|
13850
|
+
|
|
13578
13851
|
//#endregion
|
|
13579
13852
|
//#region src/dockview/allModules.ts
|
|
13580
13853
|
/**
|
|
@@ -13592,7 +13865,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
13592
13865
|
HeaderActionsModule,
|
|
13593
13866
|
LiveRegionModule,
|
|
13594
13867
|
AdvancedDnDModule,
|
|
13595
|
-
TabGroupChipsModule
|
|
13868
|
+
TabGroupChipsModule,
|
|
13869
|
+
ContextMenuModule
|
|
13596
13870
|
];
|
|
13597
13871
|
|
|
13598
13872
|
//#endregion
|
|
@@ -14284,6 +14558,14 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14284
14558
|
//#endregion
|
|
14285
14559
|
//#region src/dnd/dropTargetAnchorContainer.ts
|
|
14286
14560
|
var DropTargetAnchorContainer = class extends CompositeDisposable {
|
|
14561
|
+
/**
|
|
14562
|
+
* The element the live overlay was rendered for, `undefined` when nothing
|
|
14563
|
+
* is showing. The container is shared by every drop target, so a caller
|
|
14564
|
+
* tearing down only its own overlay must check this before `clear()`.
|
|
14565
|
+
*/
|
|
14566
|
+
get renderedOutline() {
|
|
14567
|
+
return this._model ? this._outline : void 0;
|
|
14568
|
+
}
|
|
14287
14569
|
get disabled() {
|
|
14288
14570
|
return this._disabled;
|
|
14289
14571
|
}
|
|
@@ -14588,6 +14870,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14588
14870
|
const index = position === "top" ? this._topIndex : this._bottomIndex;
|
|
14589
14871
|
if (index !== void 0) this._splitview.resizeView(index, size);
|
|
14590
14872
|
}
|
|
14873
|
+
/** The inner splitview's primary-axis (height) extent; zero until laid out. */
|
|
14874
|
+
get axisSize() {
|
|
14875
|
+
return this._splitview.size;
|
|
14876
|
+
}
|
|
14591
14877
|
updateMargin(gap) {
|
|
14592
14878
|
this._splitview.margin = gap;
|
|
14593
14879
|
}
|
|
@@ -14600,6 +14886,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14600
14886
|
constructor(container, dockviewElement, layoutGrid, gap = 0, defaultCollapsedSize = 35) {
|
|
14601
14887
|
this._disposables = new CompositeDisposable();
|
|
14602
14888
|
this._viewConfigs = /* @__PURE__ */ new Map();
|
|
14889
|
+
this._pendingSizes = /* @__PURE__ */ new Map();
|
|
14603
14890
|
this._currentWidth = 0;
|
|
14604
14891
|
this._currentHeight = 0;
|
|
14605
14892
|
this._gap = gap;
|
|
@@ -14690,11 +14977,13 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14690
14977
|
break;
|
|
14691
14978
|
}
|
|
14692
14979
|
this._disposables.addDisposables(view);
|
|
14980
|
+
if (!view.isCollapsed && !this._canResize(position)) this._pendingSizes.set(position, initialSize);
|
|
14693
14981
|
this.updateTheme(this._gap, this._defaultCollapsedSize);
|
|
14694
14982
|
return view;
|
|
14695
14983
|
}
|
|
14696
14984
|
layout(width, height) {
|
|
14697
14985
|
this._outerSplitview.layout(width, height);
|
|
14986
|
+
this._flushPendingSizes();
|
|
14698
14987
|
}
|
|
14699
14988
|
/**
|
|
14700
14989
|
* Called when the active theme changes. Updates splitview margins and
|
|
@@ -14758,6 +15047,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14758
15047
|
this._disposables.removeDisposable(view);
|
|
14759
15048
|
view.dispose();
|
|
14760
15049
|
this._viewConfigs.delete(position);
|
|
15050
|
+
this._pendingSizes.delete(position);
|
|
14761
15051
|
this.updateTheme(this._gap, this._defaultCollapsedSize);
|
|
14762
15052
|
}
|
|
14763
15053
|
hasEdgeGroup(position) {
|
|
@@ -14781,6 +15071,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14781
15071
|
this._middleColumn.setViewVisible(position, visible);
|
|
14782
15072
|
break;
|
|
14783
15073
|
}
|
|
15074
|
+
if (visible) this._flushPendingSizes();
|
|
14784
15075
|
}
|
|
14785
15076
|
isEdgeGroupVisible(position) {
|
|
14786
15077
|
switch (position) {
|
|
@@ -14798,20 +15089,63 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14798
15089
|
const view = this._getView(position);
|
|
14799
15090
|
if (!view) return;
|
|
14800
15091
|
view.setCollapsed(collapsed);
|
|
14801
|
-
|
|
15092
|
+
if (collapsed) {
|
|
15093
|
+
this._pendingSizes.delete(position);
|
|
15094
|
+
this._resizeView(position, view.collapsedSize);
|
|
15095
|
+
} else this.resizeEdgeGroup(position, view.lastExpandedSize);
|
|
15096
|
+
}
|
|
15097
|
+
/**
|
|
15098
|
+
* Resize the edge group at `position` along its primary axis (width for
|
|
15099
|
+
* `left`/`right`, height for `top`/`bottom`), clamped by the group's
|
|
15100
|
+
* constraints and the space available. Where `groupApi.setSize` lands.
|
|
15101
|
+
*
|
|
15102
|
+
* The size becomes the group's expanded size, so a collapsed group keeps
|
|
15103
|
+
* its strip and takes it on expand, and it survives a `toJSON` round-trip.
|
|
15104
|
+
*/
|
|
15105
|
+
resizeEdgeGroup(position, size) {
|
|
15106
|
+
const view = this._getView(position);
|
|
15107
|
+
if (!view || !Number.isFinite(size)) return;
|
|
15108
|
+
const target = Math.round(size);
|
|
15109
|
+
if (target <= 0) return;
|
|
15110
|
+
view.restoreExpandedSize(target);
|
|
15111
|
+
if (view.isCollapsed) {
|
|
15112
|
+
this._pendingSizes.delete(position);
|
|
15113
|
+
return;
|
|
15114
|
+
}
|
|
15115
|
+
if (this._canResize(position)) {
|
|
15116
|
+
this._pendingSizes.delete(position);
|
|
15117
|
+
this._resizeView(position, target);
|
|
15118
|
+
} else this._pendingSizes.set(position, target);
|
|
15119
|
+
}
|
|
15120
|
+
/** A resize lands only on a visible view (a hidden one is pinned to zero)
|
|
15121
|
+
* whose splitview has extent to distribute. */
|
|
15122
|
+
_canResize(position) {
|
|
15123
|
+
if (!this.isEdgeGroupVisible(position)) return false;
|
|
15124
|
+
return (position === "left" || position === "right" ? this._outerSplitview.size : this._middleColumn.axisSize) > 0;
|
|
15125
|
+
}
|
|
15126
|
+
_resizeView(position, size) {
|
|
14802
15127
|
switch (position) {
|
|
14803
15128
|
case "left":
|
|
14804
|
-
if (this._leftIndex !== void 0) this._outerSplitview.resizeView(this._leftIndex,
|
|
15129
|
+
if (this._leftIndex !== void 0) this._outerSplitview.resizeView(this._leftIndex, size);
|
|
14805
15130
|
break;
|
|
14806
15131
|
case "right":
|
|
14807
|
-
if (this._rightIndex !== void 0) this._outerSplitview.resizeView(this._rightIndex,
|
|
15132
|
+
if (this._rightIndex !== void 0) this._outerSplitview.resizeView(this._rightIndex, size);
|
|
14808
15133
|
break;
|
|
14809
15134
|
case "top":
|
|
14810
15135
|
case "bottom":
|
|
14811
|
-
this._middleColumn.resizeView(position,
|
|
15136
|
+
this._middleColumn.resizeView(position, size);
|
|
14812
15137
|
break;
|
|
14813
15138
|
}
|
|
14814
15139
|
}
|
|
15140
|
+
_flushPendingSizes() {
|
|
15141
|
+
if (this._pendingSizes.size === 0) return;
|
|
15142
|
+
for (const [position, size] of this._pendingSizes) {
|
|
15143
|
+
const view = this._getView(position);
|
|
15144
|
+
if (!view || view.isCollapsed || !this._canResize(position)) continue;
|
|
15145
|
+
this._pendingSizes.delete(position);
|
|
15146
|
+
this._resizeView(position, size);
|
|
15147
|
+
}
|
|
15148
|
+
}
|
|
14815
15149
|
isEdgeGroupCollapsed(position) {
|
|
14816
15150
|
var _this$_getView$isColl, _this$_getView;
|
|
14817
15151
|
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;
|
|
@@ -14837,15 +15171,17 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14837
15171
|
maximumSize: Number.isFinite(view.configuredMaximumSize) ? view.configuredMaximumSize : void 0,
|
|
14838
15172
|
collapsedSize: view.configuredCollapsedSize
|
|
14839
15173
|
});
|
|
14840
|
-
const expandedSize = (view, isVisible, liveSize, cachedVisibleSize) => {
|
|
15174
|
+
const expandedSize = (view, position, isVisible, liveSize, cachedVisibleSize) => {
|
|
14841
15175
|
if (view.isCollapsed) return view.lastExpandedSize;
|
|
15176
|
+
const pending = this._pendingSizes.get(position);
|
|
15177
|
+
if (pending !== void 0) return pending;
|
|
14842
15178
|
if (!isVisible) return cachedVisibleSize !== null && cachedVisibleSize !== void 0 ? cachedVisibleSize : view.lastExpandedSize;
|
|
14843
15179
|
return liveSize;
|
|
14844
15180
|
};
|
|
14845
15181
|
if (this._leftView && this._leftIndex !== void 0) {
|
|
14846
15182
|
const visible = this._outerSplitview.isViewVisible(this._leftIndex);
|
|
14847
15183
|
edgeGroups.left = _objectSpread2({
|
|
14848
|
-
size: expandedSize(this._leftView, visible, this._outerSplitview.getViewSize(this._leftIndex), this._outerSplitview.getViewCachedVisibleSize(this._leftIndex)),
|
|
15184
|
+
size: expandedSize(this._leftView, "left", visible, this._outerSplitview.getViewSize(this._leftIndex), this._outerSplitview.getViewCachedVisibleSize(this._leftIndex)),
|
|
14849
15185
|
visible,
|
|
14850
15186
|
collapsed: this._leftView.isCollapsed || void 0
|
|
14851
15187
|
}, constraints(this._leftView));
|
|
@@ -14853,7 +15189,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14853
15189
|
if (this._rightView && this._rightIndex !== void 0) {
|
|
14854
15190
|
const visible = this._outerSplitview.isViewVisible(this._rightIndex);
|
|
14855
15191
|
edgeGroups.right = _objectSpread2({
|
|
14856
|
-
size: expandedSize(this._rightView, visible, this._outerSplitview.getViewSize(this._rightIndex), this._outerSplitview.getViewCachedVisibleSize(this._rightIndex)),
|
|
15192
|
+
size: expandedSize(this._rightView, "right", visible, this._outerSplitview.getViewSize(this._rightIndex), this._outerSplitview.getViewCachedVisibleSize(this._rightIndex)),
|
|
14857
15193
|
visible,
|
|
14858
15194
|
collapsed: this._rightView.isCollapsed || void 0
|
|
14859
15195
|
}, constraints(this._rightView));
|
|
@@ -14861,7 +15197,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14861
15197
|
if (this._topView) {
|
|
14862
15198
|
const visible = this._middleColumn.isViewVisible("top");
|
|
14863
15199
|
edgeGroups.top = _objectSpread2({
|
|
14864
|
-
size: expandedSize(this._topView, visible, this._middleColumn.getViewSize("top"), this._middleColumn.getViewCachedVisibleSize("top")),
|
|
15200
|
+
size: expandedSize(this._topView, "top", visible, this._middleColumn.getViewSize("top"), this._middleColumn.getViewCachedVisibleSize("top")),
|
|
14865
15201
|
visible,
|
|
14866
15202
|
collapsed: this._topView.isCollapsed || void 0
|
|
14867
15203
|
}, constraints(this._topView));
|
|
@@ -14869,7 +15205,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14869
15205
|
if (this._bottomView) {
|
|
14870
15206
|
const visible = this._middleColumn.isViewVisible("bottom");
|
|
14871
15207
|
edgeGroups.bottom = _objectSpread2({
|
|
14872
|
-
size: expandedSize(this._bottomView, visible, this._middleColumn.getViewSize("bottom"), this._middleColumn.getViewCachedVisibleSize("bottom")),
|
|
15208
|
+
size: expandedSize(this._bottomView, "bottom", visible, this._middleColumn.getViewSize("bottom"), this._middleColumn.getViewCachedVisibleSize("bottom")),
|
|
14873
15209
|
visible,
|
|
14874
15210
|
collapsed: this._bottomView.isCollapsed || void 0
|
|
14875
15211
|
}, constraints(this._bottomView));
|
|
@@ -14877,33 +15213,23 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
14877
15213
|
return edgeGroups;
|
|
14878
15214
|
}
|
|
14879
15215
|
fromJSON(data) {
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
|
|
14886
|
-
|
|
14887
|
-
|
|
14888
|
-
|
|
14889
|
-
(
|
|
14890
|
-
|
|
14891
|
-
|
|
14892
|
-
if (
|
|
14893
|
-
|
|
14894
|
-
|
|
14895
|
-
|
|
14896
|
-
|
|
14897
|
-
(_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);
|
|
14898
|
-
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);
|
|
14899
|
-
if (!data.top.visible) this._middleColumn.setViewVisible("top", false);
|
|
14900
|
-
}
|
|
14901
|
-
if (data.bottom) {
|
|
14902
|
-
var _this$_bottomView2, _this$_bottomView3, _data$bottom$collapse, _this$_bottomView$col, _this$_bottomView4;
|
|
14903
|
-
(_this$_bottomView2 = this._bottomView) === null || _this$_bottomView2 === void 0 || _this$_bottomView2.restoreExpandedSize(data.bottom.size);
|
|
14904
|
-
(_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);
|
|
14905
|
-
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);
|
|
14906
|
-
if (!data.bottom.visible) this._middleColumn.setViewVisible("bottom", false);
|
|
15216
|
+
for (const position of [
|
|
15217
|
+
"left",
|
|
15218
|
+
"right",
|
|
15219
|
+
"top",
|
|
15220
|
+
"bottom"
|
|
15221
|
+
]) {
|
|
15222
|
+
var _state$collapsed;
|
|
15223
|
+
const state = data[position];
|
|
15224
|
+
const view = this._getView(position);
|
|
15225
|
+
if (!state || !view) continue;
|
|
15226
|
+
view.restoreExpandedSize(state.size);
|
|
15227
|
+
view.setCollapsed((_state$collapsed = state.collapsed) !== null && _state$collapsed !== void 0 ? _state$collapsed : false);
|
|
15228
|
+
if (state.collapsed) {
|
|
15229
|
+
this._pendingSizes.delete(position);
|
|
15230
|
+
this._resizeView(position, view.collapsedSize);
|
|
15231
|
+
} else this.resizeEdgeGroup(position, state.size);
|
|
15232
|
+
this.setEdgeGroupVisible(position, !!state.visible);
|
|
14907
15233
|
}
|
|
14908
15234
|
}
|
|
14909
15235
|
dispose() {
|
|
@@ -16288,6 +16614,13 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
16288
16614
|
position
|
|
16289
16615
|
};
|
|
16290
16616
|
group.model.headerPosition = position;
|
|
16617
|
+
const resizeDisposable = group.onDidChange((event) => {
|
|
16618
|
+
var _this$_shellManager3;
|
|
16619
|
+
if (!event) return;
|
|
16620
|
+
const size = position === "left" || position === "right" ? event.width : event.height;
|
|
16621
|
+
if (typeof size !== "number") return;
|
|
16622
|
+
(_this$_shellManager3 = this._shellManager) === null || _this$_shellManager3 === void 0 || _this$_shellManager3.resizeEdgeGroup(position, size);
|
|
16623
|
+
});
|
|
16291
16624
|
const autoCollapseDisposable = group.model.onDidRemovePanel(() => {
|
|
16292
16625
|
if (!group.model.isEmpty) return;
|
|
16293
16626
|
if (service.isAutoReveal(group)) queueMicrotask(() => {
|
|
@@ -16296,7 +16629,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
16296
16629
|
});
|
|
16297
16630
|
else this.setEdgeGroupCollapsed(group, true);
|
|
16298
16631
|
});
|
|
16299
|
-
service.add(position, group, autoCollapseDisposable);
|
|
16632
|
+
service.add(position, group, new CompositeDisposable(autoCollapseDisposable, resizeDisposable));
|
|
16300
16633
|
if (options.autoHide !== void 0) service.setAutoHide(group, options.autoHide);
|
|
16301
16634
|
if (options.autoReveal !== void 0) service.setAutoReveal(group, options.autoReveal);
|
|
16302
16635
|
this._onDidAddGroup.fire(group);
|
|
@@ -16391,8 +16724,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
16391
16724
|
}
|
|
16392
16725
|
/** The size an edge group expands to (pre-collapse); sizes the peek. */
|
|
16393
16726
|
getEdgeGroupExpandedSize(position) {
|
|
16394
|
-
var _this$_shellManager$g, _this$
|
|
16395
|
-
return (_this$_shellManager$g = (_this$
|
|
16727
|
+
var _this$_shellManager$g, _this$_shellManager4;
|
|
16728
|
+
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;
|
|
16396
16729
|
}
|
|
16397
16730
|
/** Reposition a single `renderer:'always'` panel's overlay over its
|
|
16398
16731
|
* reference container, optionally forcing it visible (the auto-hide peek
|
|
@@ -17553,7 +17886,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17553
17886
|
}));
|
|
17554
17887
|
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
17555
17888
|
const updatedTargetLocation = getRelativeLocation(destinationGridview.orientation, getGridLocation(destinationGroup.element), destinationTarget);
|
|
17556
|
-
const newGroup = this.createGroupAtLocation(updatedTargetLocation,
|
|
17889
|
+
const newGroup = this.createGroupAtLocation(updatedTargetLocation, this.dropSizing(getGridLocation(destinationGroup.element)), void 0, destinationGridview);
|
|
17557
17890
|
this.movingLock(() => newGroup.model.openPanel(removedPanel, { skipSetActive: true }));
|
|
17558
17891
|
this.doSetGroupAndPanelActive(newGroup);
|
|
17559
17892
|
this.fireDidMovePanel(this.getGroupPanel(sourceItemId), sourceGroup);
|
|
@@ -17570,7 +17903,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17570
17903
|
skipSetActiveGroup: true
|
|
17571
17904
|
}));
|
|
17572
17905
|
if (!removedPanel) throw new Error(`dockview: No panel with id ${sourceItemId}`);
|
|
17573
|
-
const newGroup = this.createGroupAtLocation(targetLocation,
|
|
17906
|
+
const newGroup = this.createGroupAtLocation(targetLocation, this.dropSizing(referenceLocation), void 0, destinationGridview);
|
|
17574
17907
|
this.movingLock(() => newGroup.model.openPanel(removedPanel, { skipSetGroupActive: true }));
|
|
17575
17908
|
this.doSetGroupAndPanelActive(newGroup);
|
|
17576
17909
|
this.fireDidMovePanel(removedPanel, sourceGroup);
|
|
@@ -17582,7 +17915,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17582
17915
|
}));
|
|
17583
17916
|
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
17584
17917
|
const location = getRelativeLocation(destinationGridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
17585
|
-
this.movingLock(() => this.doAddGroup(targetGroup, location,
|
|
17918
|
+
this.movingLock(() => this.doAddGroup(targetGroup, location, this.dropSizing(updatedReferenceLocation), destinationGridview));
|
|
17586
17919
|
this.setGroupLocationForRoot(targetGroup, destinationGridview);
|
|
17587
17920
|
this.doSetGroupAndPanelActive(targetGroup);
|
|
17588
17921
|
this.fireDidMovePanel(this.getGroupPanel(sourceItemId), sourceGroup);
|
|
@@ -17597,7 +17930,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17597
17930
|
}));
|
|
17598
17931
|
if (!removedPanel) throw new Error(`dockview: No panel with id ${sourceItemId}`);
|
|
17599
17932
|
const dropLocation = getRelativeLocation(destinationGridview.orientation, referenceLocation, destinationTarget);
|
|
17600
|
-
const group = this.createGroupAtLocation(dropLocation,
|
|
17933
|
+
const group = this.createGroupAtLocation(dropLocation, this.dropSizing(referenceLocation), void 0, destinationGridview);
|
|
17601
17934
|
this.movingLock(() => group.model.openPanel(removedPanel, { skipSetGroupActive: true }));
|
|
17602
17935
|
this.doSetGroupAndPanelActive(group);
|
|
17603
17936
|
this.fireDidMovePanel(removedPanel, sourceGroup);
|
|
@@ -17641,7 +17974,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17641
17974
|
if (!destinationTarget || destinationTarget === "center" || !referenceLocation) targetGroup = destinationGroup;
|
|
17642
17975
|
else {
|
|
17643
17976
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
17644
|
-
targetGroup = this.createGroupAtLocation(dropLocation);
|
|
17977
|
+
targetGroup = this.createGroupAtLocation(dropLocation, this.dropSizing(referenceLocation));
|
|
17645
17978
|
}
|
|
17646
17979
|
if (!options.keepEmptyGroups && sourceGroup.model.size === 0 && sourceGroup !== targetGroup) this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
17647
17980
|
addPanelsToGroup(targetGroup);
|
|
@@ -17692,6 +18025,21 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17692
18025
|
if (options.skipSetActive !== true) this.doSetGroupAndPanelActive(to);
|
|
17693
18026
|
else if (!this.activePanel) this.doSetGroupAndPanelActive(to);
|
|
17694
18027
|
} else {
|
|
18028
|
+
const isReorderWithinBranch = (() => {
|
|
18029
|
+
if (from.api.location.type === "edge" || to.api.location.type === "edge") return false;
|
|
18030
|
+
const root = this.getGridviewForGroup(from);
|
|
18031
|
+
if (root !== this.getGridviewForGroup(to)) return false;
|
|
18032
|
+
let fromLocation;
|
|
18033
|
+
let toLocation;
|
|
18034
|
+
try {
|
|
18035
|
+
fromLocation = getGridLocation(from.element);
|
|
18036
|
+
toLocation = getGridLocation(to.element);
|
|
18037
|
+
} catch (_unused) {
|
|
18038
|
+
return false;
|
|
18039
|
+
}
|
|
18040
|
+
if (fromLocation.length === 0 || toLocation.length === 0) return false;
|
|
18041
|
+
return sequenceEquals(tail(fromLocation)[0], tail(toLocation)[0]) && getLocationOrientation(root.orientation, toLocation) === getDirectionOrientation(target);
|
|
18042
|
+
})();
|
|
17695
18043
|
if (from.api.location.type === "edge") {
|
|
17696
18044
|
/**
|
|
17697
18045
|
* Edge groups are permanent structural elements and must
|
|
@@ -17757,13 +18105,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17757
18105
|
const referenceLocation = getGridLocation(to.element);
|
|
17758
18106
|
const dropLocation = getRelativeLocation(destGridview.orientation, referenceLocation, target);
|
|
17759
18107
|
let size;
|
|
17760
|
-
|
|
17761
|
-
|
|
17762
|
-
|
|
17763
|
-
|
|
17764
|
-
case "HORIZONTAL":
|
|
17765
|
-
size = referenceLocation.length % 2 == 0 ? from.api.height : from.api.width;
|
|
17766
|
-
break;
|
|
18108
|
+
if (isReorderWithinBranch) size = getDirectionOrientation(target) === "HORIZONTAL" ? from.api.width : from.api.height;
|
|
18109
|
+
else {
|
|
18110
|
+
var _referenceLocation;
|
|
18111
|
+
size = Sizing.Split((_referenceLocation = referenceLocation[referenceLocation.length - 1]) !== null && _referenceLocation !== void 0 ? _referenceLocation : 0);
|
|
17767
18112
|
}
|
|
17768
18113
|
destGridview.addView(source, size, dropLocation);
|
|
17769
18114
|
this.setGroupLocationForRoot(source, destGridview);
|
|
@@ -17888,6 +18233,16 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17888
18233
|
});
|
|
17889
18234
|
return panel;
|
|
17890
18235
|
}
|
|
18236
|
+
/**
|
|
18237
|
+
* Sizing for a group created by a drop next to `referenceLocation`: half
|
|
18238
|
+
* of the group the overlay was drawn over, leaving its siblings alone, so
|
|
18239
|
+
* the panel lands in the region the overlay indicated (#1612). Gridview
|
|
18240
|
+
* rewrites the index to 0 when a cross-axis drop wraps the reference in a
|
|
18241
|
+
* new branch, so one value serves both paths.
|
|
18242
|
+
*/
|
|
18243
|
+
dropSizing(referenceLocation) {
|
|
18244
|
+
return Sizing.Split(referenceLocation.length === 0 ? 0 : referenceLocation[referenceLocation.length - 1]);
|
|
18245
|
+
}
|
|
17891
18246
|
createGroupAtLocation(location, size, options, gridview = this.gridview) {
|
|
17892
18247
|
const group = this.createGroup(options);
|
|
17893
18248
|
this.doAddGroup(group, location, size, gridview);
|
|
@@ -17947,22 +18302,22 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
17947
18302
|
return location.length % 2 == 1 ? rootOrientation : orthogonal(rootOrientation);
|
|
17948
18303
|
}
|
|
17949
18304
|
updateTheme() {
|
|
17950
|
-
var _this$_options$theme, _this$_shellThemeClas, _theme$gap, _this$_popoutWindowSe23, _this$_popoutWindowSe24, _this$
|
|
18305
|
+
var _this$_options$theme, _this$_shellThemeClas, _theme$gap, _this$_popoutWindowSe23, _this$_popoutWindowSe24, _this$_shellManager5, _theme$edgeGroupColla, _theme$tabGroupIndica;
|
|
17951
18306
|
const theme = (_this$_options$theme = this._options.theme) !== null && _this$_options$theme !== void 0 ? _this$_options$theme : themeAbyss;
|
|
17952
18307
|
(_this$_shellThemeClas = this._shellThemeClassnames) === null || _this$_shellThemeClas === void 0 || _this$_shellThemeClas.setClassNames(theme.className);
|
|
17953
18308
|
const gap = (_theme$gap = theme.gap) !== null && _theme$gap !== void 0 ? _theme$gap : 0;
|
|
17954
18309
|
this.gridview.margin = gap;
|
|
17955
18310
|
for (const floating of this.floatingGroups) floating.gridview.margin = gap;
|
|
17956
18311
|
for (const entry of (_this$_popoutWindowSe23 = (_this$_popoutWindowSe24 = this._popoutWindowService) === null || _this$_popoutWindowSe24 === void 0 ? void 0 : _this$_popoutWindowSe24.entries) !== null && _this$_popoutWindowSe23 !== void 0 ? _this$_popoutWindowSe23 : []) entry.gridview.margin = gap;
|
|
17957
|
-
(_this$
|
|
18312
|
+
(_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);
|
|
17958
18313
|
if (theme.dndOverlayBorder === void 0) {
|
|
17959
|
-
var _this$
|
|
18314
|
+
var _this$_shellManager6;
|
|
17960
18315
|
this.element.style.removeProperty("--dv-drag-over-border");
|
|
17961
|
-
(_this$
|
|
18316
|
+
(_this$_shellManager6 = this._shellManager) === null || _this$_shellManager6 === void 0 || _this$_shellManager6.element.style.removeProperty("--dv-drag-over-border");
|
|
17962
18317
|
} else {
|
|
17963
|
-
var _this$
|
|
18318
|
+
var _this$_shellManager7;
|
|
17964
18319
|
this.element.style.setProperty("--dv-drag-over-border", theme.dndOverlayBorder);
|
|
17965
|
-
(_this$
|
|
18320
|
+
(_this$_shellManager7 = this._shellManager) === null || _this$_shellManager7 === void 0 || _this$_shellManager7.element.style.setProperty("--dv-drag-over-border", theme.dndOverlayBorder);
|
|
17966
18321
|
}
|
|
17967
18322
|
switch (theme.dndOverlayMounting) {
|
|
17968
18323
|
case "absolute":
|
|
@@ -18865,6 +19220,8 @@ exports.AdvancedDnDModule = AdvancedDnDModule;
|
|
|
18865
19220
|
exports.AdvancedDnDService = AdvancedDnDService;
|
|
18866
19221
|
exports.BaseGrid = BaseGrid;
|
|
18867
19222
|
exports.ContentContainer = ContentContainer;
|
|
19223
|
+
exports.ContextMenuController = ContextMenuController;
|
|
19224
|
+
exports.ContextMenuModule = ContextMenuModule;
|
|
18868
19225
|
exports.DEFAULT_TAB_GROUP_COLORS = DEFAULT_TAB_GROUP_COLORS;
|
|
18869
19226
|
exports.DefaultDockviewDeserialzier = DefaultDockviewDeserialzier;
|
|
18870
19227
|
exports.DefaultTab = DefaultTab;
|