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