dockview-react 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/dockview-react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-react
|
|
3
|
-
* @version 8.
|
|
3
|
+
* @version 8.3.0
|
|
4
4
|
* @link https://github.com/dockview/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -51,7 +51,7 @@ react_dom = __toESM(react_dom);
|
|
|
51
51
|
//#region ../dockview-core/dist/package/main.esm.mjs
|
|
52
52
|
/**
|
|
53
53
|
* dockview-core
|
|
54
|
-
* @version 8.
|
|
54
|
+
* @version 8.3.0
|
|
55
55
|
* @link https://github.com/dockview/dockview
|
|
56
56
|
* @license MIT
|
|
57
57
|
*/
|
|
@@ -1077,8 +1077,14 @@ react_dom = __toESM(react_dom);
|
|
|
1077
1077
|
container.appendChild(view.element);
|
|
1078
1078
|
let viewSize;
|
|
1079
1079
|
if (typeof size === "number") viewSize = size;
|
|
1080
|
-
else if (size.type === "split")
|
|
1081
|
-
|
|
1080
|
+
else if (size.type === "split") {
|
|
1081
|
+
const splitTarget = this.viewItems[size.index];
|
|
1082
|
+
if (splitTarget) {
|
|
1083
|
+
const half = Math.floor(splitTarget.size / 2);
|
|
1084
|
+
viewSize = splitTarget.size - half;
|
|
1085
|
+
splitTarget.size = half;
|
|
1086
|
+
} else viewSize = this.getViewSize(size.index) / 2;
|
|
1087
|
+
} else if (size.type === "invisible") viewSize = { cachedVisibleSize: size.cachedVisibleSize };
|
|
1082
1088
|
else viewSize = view.minimumSize;
|
|
1083
1089
|
const disposable = view.onDidChange((newSize) => this.onDidChange(viewItem, newSize.size));
|
|
1084
1090
|
const viewItem = new ViewItem(container, view, viewSize, { dispose: () => {
|
|
@@ -5718,7 +5724,7 @@ react_dom = __toESM(react_dom);
|
|
|
5718
5724
|
};
|
|
5719
5725
|
case "auto":
|
|
5720
5726
|
case void 0:
|
|
5721
|
-
default: return isCoarsePrimaryInput$
|
|
5727
|
+
default: return isCoarsePrimaryInput$2() ? {
|
|
5722
5728
|
html5: false,
|
|
5723
5729
|
pointer: true,
|
|
5724
5730
|
pointerHandlesMouse: true
|
|
@@ -5729,7 +5735,7 @@ react_dom = __toESM(react_dom);
|
|
|
5729
5735
|
};
|
|
5730
5736
|
}
|
|
5731
5737
|
}
|
|
5732
|
-
function isCoarsePrimaryInput$
|
|
5738
|
+
function isCoarsePrimaryInput$2() {
|
|
5733
5739
|
if (globalThis.window === void 0 || !globalThis.matchMedia) return false;
|
|
5734
5740
|
const coarse = globalThis.matchMedia("(pointer: coarse)").matches;
|
|
5735
5741
|
const fine = globalThis.matchMedia("(pointer: fine)").matches;
|
|
@@ -7850,11 +7856,28 @@ react_dom = __toESM(react_dom);
|
|
|
7850
7856
|
if (this._voidContainer && related && (related === this._voidContainer || this._voidContainer.contains(related))) return;
|
|
7851
7857
|
this.resetTabTransforms();
|
|
7852
7858
|
if (this._animState.sourceIndex === -1) {
|
|
7853
|
-
|
|
7854
|
-
(_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();
|
|
7859
|
+
this.clearHeaderAnchorOverlay();
|
|
7855
7860
|
this._animState = null;
|
|
7856
7861
|
} else this._animState.currentInsertionIndex = null;
|
|
7857
7862
|
}
|
|
7863
|
+
/**
|
|
7864
|
+
* Clear the anchored overlay only when this header is what rendered it.
|
|
7865
|
+
* The container is shared with the group's content drop target, which
|
|
7866
|
+
* renders into it on the same frame the cursor leaves the strip: the
|
|
7867
|
+
* pointer backend calls `handleDragOver` on the new target before the
|
|
7868
|
+
* global `onDragMove` that reaches us (#1612).
|
|
7869
|
+
*/
|
|
7870
|
+
clearHeaderAnchorOverlay() {
|
|
7871
|
+
var _container$model;
|
|
7872
|
+
const container = this.group.model.dropTargetContainer;
|
|
7873
|
+
const outline = container === null || container === void 0 ? void 0 : container.renderedOutline;
|
|
7874
|
+
if (outline && ![
|
|
7875
|
+
this._tabsList,
|
|
7876
|
+
this._voidContainer,
|
|
7877
|
+
this._extendedDropZone
|
|
7878
|
+
].some((scope) => scope === null || scope === void 0 ? void 0 : scope.contains(outline))) return;
|
|
7879
|
+
container === null || container === void 0 || (_container$model = container.model) === null || _container$model === void 0 || _container$model.clear();
|
|
7880
|
+
}
|
|
7858
7881
|
handleDragOver(event) {
|
|
7859
7882
|
var _this$accessor$option2;
|
|
7860
7883
|
if (!this._animState) return;
|
|
@@ -12227,7 +12250,6 @@ react_dom = __toESM(react_dom);
|
|
|
12227
12250
|
"AdvancedOverflow",
|
|
12228
12251
|
"AutoEdgeGroup",
|
|
12229
12252
|
"AutoHideEdgeGroup",
|
|
12230
|
-
"ContextMenu",
|
|
12231
12253
|
"DndCompass",
|
|
12232
12254
|
"KeyboardDocking",
|
|
12233
12255
|
"KeyboardNavigation",
|
|
@@ -12309,8 +12331,8 @@ react_dom = __toESM(react_dom);
|
|
|
12309
12331
|
* case: calling `undo()` having never set the option at all.
|
|
12310
12332
|
*
|
|
12311
12333
|
* Interaction handlers are queries in this sense too: a right-click reaching an
|
|
12312
|
-
* absent
|
|
12313
|
-
*
|
|
12334
|
+
* absent module means the app never asked for that feature, so it stays silent
|
|
12335
|
+
* (`?.`) and the browser's own behaviour applies. Options are where intent is
|
|
12314
12336
|
* declared; see `optionsModules.ts`.
|
|
12315
12337
|
*/
|
|
12316
12338
|
function assertModule(service, moduleName, context) {
|
|
@@ -12387,10 +12409,9 @@ react_dom = __toESM(react_dom);
|
|
|
12387
12409
|
*
|
|
12388
12410
|
* This is the "declared intent" diagnostic. It fires when the user asks for a
|
|
12389
12411
|
* feature via options, at construction and on every `updateOptions`. It
|
|
12390
|
-
* deliberately does *not* fire on user interaction:
|
|
12391
|
-
*
|
|
12392
|
-
*
|
|
12393
|
-
* app never wanted.
|
|
12412
|
+
* deliberately does *not* fire on user interaction: an interaction reaching an
|
|
12413
|
+
* absent module stays silent, because the `?.` service-slot call sites can't
|
|
12414
|
+
* tell a missing module from a feature the app never wanted.
|
|
12394
12415
|
*
|
|
12395
12416
|
* Rules are a flat list rather than a `Record<keyof DockviewOptions, ...>`
|
|
12396
12417
|
* because dockview's options are nested and value-gated: `overflow.mode:
|
|
@@ -12486,18 +12507,6 @@ react_dom = __toESM(react_dom);
|
|
|
12486
12507
|
moduleName: "AutoEdgeGroup",
|
|
12487
12508
|
when: (o) => isAnyEdgeGroupEnabled(o.dockToEdgeGroups)
|
|
12488
12509
|
},
|
|
12489
|
-
{
|
|
12490
|
-
optionKey: "getTabContextMenuItems",
|
|
12491
|
-
reason: "getTabContextMenuItems",
|
|
12492
|
-
moduleName: "ContextMenu",
|
|
12493
|
-
when: (o) => o.getTabContextMenuItems != null
|
|
12494
|
-
},
|
|
12495
|
-
{
|
|
12496
|
-
optionKey: "getTabGroupChipContextMenuItems",
|
|
12497
|
-
reason: "getTabGroupChipContextMenuItems",
|
|
12498
|
-
moduleName: "ContextMenu",
|
|
12499
|
-
when: (o) => o.getTabGroupChipContextMenuItems != null
|
|
12500
|
-
},
|
|
12501
12510
|
{
|
|
12502
12511
|
optionKey: "dndCompass",
|
|
12503
12512
|
reason: "dndCompass",
|
|
@@ -13364,6 +13373,267 @@ react_dom = __toESM(react_dom);
|
|
|
13364
13373
|
} });
|
|
13365
13374
|
}
|
|
13366
13375
|
});
|
|
13376
|
+
function popoverZIndexFor(target, group) {
|
|
13377
|
+
var _group$api, _group$api$isPeeking;
|
|
13378
|
+
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)";
|
|
13379
|
+
if (!(target instanceof HTMLElement)) return;
|
|
13380
|
+
const relativeParent = findRelativeZIndexParent(target);
|
|
13381
|
+
return (relativeParent === null || relativeParent === void 0 ? void 0 : relativeParent.style.zIndex) ? `calc(${relativeParent.style.zIndex} * 2)` : void 0;
|
|
13382
|
+
}
|
|
13383
|
+
let _nextId = 0;
|
|
13384
|
+
const nextContextMenuItemId = () => `dv-ctx-menu-item-${_nextId++}`;
|
|
13385
|
+
function isItemConfig(item) {
|
|
13386
|
+
return typeof item === "object";
|
|
13387
|
+
}
|
|
13388
|
+
function buildItem(label, close, action, disabled) {
|
|
13389
|
+
const el = document.createElement("div");
|
|
13390
|
+
el.className = "dv-context-menu-item";
|
|
13391
|
+
el.setAttribute("role", "menuitem");
|
|
13392
|
+
if (disabled) {
|
|
13393
|
+
el.classList.add("dv-context-menu-item--disabled");
|
|
13394
|
+
el.setAttribute("aria-disabled", "true");
|
|
13395
|
+
}
|
|
13396
|
+
el.textContent = label;
|
|
13397
|
+
if (!disabled) el.addEventListener("click", () => {
|
|
13398
|
+
action();
|
|
13399
|
+
close();
|
|
13400
|
+
});
|
|
13401
|
+
return el;
|
|
13402
|
+
}
|
|
13403
|
+
function buildSeparator() {
|
|
13404
|
+
const el = document.createElement("div");
|
|
13405
|
+
el.className = "dv-context-menu-separator";
|
|
13406
|
+
el.setAttribute("role", "separator");
|
|
13407
|
+
return el;
|
|
13408
|
+
}
|
|
13409
|
+
function isCoarsePrimaryInput$1() {
|
|
13410
|
+
if (globalThis.window === void 0 || !globalThis.matchMedia) return false;
|
|
13411
|
+
const coarse = globalThis.matchMedia("(pointer: coarse)").matches;
|
|
13412
|
+
const fine = globalThis.matchMedia("(pointer: fine)").matches;
|
|
13413
|
+
return coarse && !fine;
|
|
13414
|
+
}
|
|
13415
|
+
function buildRenameInput(tabGroup) {
|
|
13416
|
+
const wrapper = document.createElement("div");
|
|
13417
|
+
wrapper.className = "dv-context-menu-rename";
|
|
13418
|
+
const input = document.createElement("input");
|
|
13419
|
+
input.className = "dv-context-menu-rename-input";
|
|
13420
|
+
input.type = "text";
|
|
13421
|
+
input.placeholder = "Name This Group";
|
|
13422
|
+
input.value = tabGroup.label;
|
|
13423
|
+
input.addEventListener("input", () => {
|
|
13424
|
+
tabGroup.setLabel(input.value);
|
|
13425
|
+
});
|
|
13426
|
+
input.addEventListener("keydown", (e) => {
|
|
13427
|
+
if (e.key !== "Escape" && e.key !== "Enter") e.stopPropagation();
|
|
13428
|
+
});
|
|
13429
|
+
input.addEventListener("click", (e) => {
|
|
13430
|
+
e.stopPropagation();
|
|
13431
|
+
});
|
|
13432
|
+
wrapper.appendChild(input);
|
|
13433
|
+
if (!isCoarsePrimaryInput$1()) requestAnimationFrame(() => {
|
|
13434
|
+
input.focus();
|
|
13435
|
+
input.select();
|
|
13436
|
+
});
|
|
13437
|
+
return wrapper;
|
|
13438
|
+
}
|
|
13439
|
+
function buildColorPicker(tabGroup, palette) {
|
|
13440
|
+
const wrapper = document.createElement("div");
|
|
13441
|
+
wrapper.className = "dv-context-menu-color-picker";
|
|
13442
|
+
if (!palette.enabled) return wrapper;
|
|
13443
|
+
for (const entry of palette.entries()) {
|
|
13444
|
+
const swatch = document.createElement("div");
|
|
13445
|
+
swatch.className = "dv-context-menu-color-swatch";
|
|
13446
|
+
swatch.style.setProperty("--dv-tab-group-color", entry.value);
|
|
13447
|
+
if (entry.label) swatch.title = entry.label;
|
|
13448
|
+
if (tabGroup.color === entry.id) swatch.classList.add("dv-context-menu-color-swatch--selected");
|
|
13449
|
+
swatch.addEventListener("click", () => {
|
|
13450
|
+
tabGroup.setColor(entry.id);
|
|
13451
|
+
});
|
|
13452
|
+
wrapper.appendChild(swatch);
|
|
13453
|
+
}
|
|
13454
|
+
return wrapper;
|
|
13455
|
+
}
|
|
13456
|
+
var ContextMenuController = class {
|
|
13457
|
+
constructor(accessor) {
|
|
13458
|
+
this.accessor = accessor;
|
|
13459
|
+
}
|
|
13460
|
+
/**
|
|
13461
|
+
* A single maximize/restore toggle whose label and behaviour track the
|
|
13462
|
+
* group's live state: it reads *Restore* + calls `exitMaximized` when the
|
|
13463
|
+
* group is maximized, otherwise *Maximize* + `maximize`. Only grid groups
|
|
13464
|
+
* can be maximized, so the item is disabled for floating / popout panels
|
|
13465
|
+
* that are not already maximized.
|
|
13466
|
+
*/
|
|
13467
|
+
buildMaximizeItem(panel, close) {
|
|
13468
|
+
const isMaximized = panel.api.isMaximized();
|
|
13469
|
+
return buildItem(isMaximized ? "Restore" : "Maximize", close, isMaximized ? () => panel.api.exitMaximized() : () => panel.api.maximize(), !isMaximized && panel.api.location.type !== "grid");
|
|
13470
|
+
}
|
|
13471
|
+
/**
|
|
13472
|
+
* A single collapse/expand toggle whose label tracks the tab group's live
|
|
13473
|
+
* state: *Expand* when the group is already collapsed, otherwise *Collapse*.
|
|
13474
|
+
*/
|
|
13475
|
+
buildCollapseItem(tabGroup, close) {
|
|
13476
|
+
return buildItem(tabGroup.collapsed ? "Expand" : "Collapse", close, () => tabGroup.toggle());
|
|
13477
|
+
}
|
|
13478
|
+
/**
|
|
13479
|
+
* Whether to auto-inject the built-in Pin/Unpin item at the top of the tab
|
|
13480
|
+
* menu. True only when the PinnedTabs module is registered, pinning is
|
|
13481
|
+
* enabled, and the app has not opted out via `pinnedTabs.contextMenuItem:
|
|
13482
|
+
* false` (the item is on by default). This keeps pinning reachable from the
|
|
13483
|
+
* menu without the app having to return `'pin'` from
|
|
13484
|
+
* `getTabContextMenuItems` itself.
|
|
13485
|
+
*/
|
|
13486
|
+
_shouldInjectPin() {
|
|
13487
|
+
const pinnedTabs = this.accessor.options.pinnedTabs;
|
|
13488
|
+
return !!this.accessor.pinnedTabsService && !!(pinnedTabs === null || pinnedTabs === void 0 ? void 0 : pinnedTabs.enabled) && pinnedTabs.contextMenuItem !== false;
|
|
13489
|
+
}
|
|
13490
|
+
/**
|
|
13491
|
+
* The tab menu items: the app's own items (if any) with the built-in
|
|
13492
|
+
* `'pin'` item prepended when {@link _shouldInjectPin} applies, so the app
|
|
13493
|
+
* keeps full control of its list, and pinning is added without disturbing
|
|
13494
|
+
* it. Reuses the existing `'pin'` token rendering below.
|
|
13495
|
+
*/
|
|
13496
|
+
_resolveTabItems(panel, group, event) {
|
|
13497
|
+
var _this$accessor$option, _this$accessor$option2, _this$accessor$option3;
|
|
13498
|
+
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, {
|
|
13499
|
+
panel,
|
|
13500
|
+
group,
|
|
13501
|
+
api: this.accessor.api,
|
|
13502
|
+
event
|
|
13503
|
+
})) !== null && _this$accessor$option !== void 0 ? _this$accessor$option : [];
|
|
13504
|
+
return this._shouldInjectPin() ? ["pin", ...appItems] : appItems;
|
|
13505
|
+
}
|
|
13506
|
+
/**
|
|
13507
|
+
* Render a custom `component` menu item and append it to `menuEl`. Builds
|
|
13508
|
+
* the framework renderer via the host's `createContextMenuItemComponent`
|
|
13509
|
+
* factory and initialises it. Shared by the tab menu and the chip menu,
|
|
13510
|
+
* which differ only in `identity`: the tab menu passes the `panel`, the chip
|
|
13511
|
+
* menu passes the `tabGroup`. No-op when no renderer could be created (no
|
|
13512
|
+
* factory configured, or the factory declined the component).
|
|
13513
|
+
*/
|
|
13514
|
+
appendComponentItem(menuEl, item, identity, group, close) {
|
|
13515
|
+
var _this$accessor$option4, _this$accessor$option5;
|
|
13516
|
+
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, {
|
|
13517
|
+
id: nextContextMenuItemId(),
|
|
13518
|
+
component: item.component
|
|
13519
|
+
});
|
|
13520
|
+
if (!renderer) return;
|
|
13521
|
+
renderer.init(_objectSpread2$1(_objectSpread2$1({}, identity), {}, {
|
|
13522
|
+
group,
|
|
13523
|
+
api: this.accessor.api,
|
|
13524
|
+
close,
|
|
13525
|
+
componentProps: item.componentProps
|
|
13526
|
+
}));
|
|
13527
|
+
menuEl.appendChild(renderer.element);
|
|
13528
|
+
}
|
|
13529
|
+
/**
|
|
13530
|
+
* The element for one built-in tab item, or `undefined` for a token this
|
|
13531
|
+
* version doesn't know (an app on a newer typings version, or plain JS):
|
|
13532
|
+
* an unrecognised token renders nothing rather than throwing.
|
|
13533
|
+
*/
|
|
13534
|
+
buildBuiltInTabItem(item, panel, group, close) {
|
|
13535
|
+
switch (item) {
|
|
13536
|
+
case "separator": return buildSeparator();
|
|
13537
|
+
case "close": return buildItem("Close", close, () => panel.api.close());
|
|
13538
|
+
case "closeOthers": return buildItem("Close Others", close, () => {
|
|
13539
|
+
group.panels.filter((p) => p !== panel).forEach((p) => p.api.close());
|
|
13540
|
+
});
|
|
13541
|
+
case "closeAll": return buildItem("Close All", close, () => {
|
|
13542
|
+
[...group.panels].forEach((p) => p.api.close());
|
|
13543
|
+
});
|
|
13544
|
+
case "closeLeft": {
|
|
13545
|
+
const index = group.panels.indexOf(panel);
|
|
13546
|
+
return buildItem("Close to the Left", close, () => {
|
|
13547
|
+
group.panels.filter((_, i) => i < index).forEach((p) => p.api.close());
|
|
13548
|
+
}, index <= 0);
|
|
13549
|
+
}
|
|
13550
|
+
case "closeRight": {
|
|
13551
|
+
const index = group.panels.indexOf(panel);
|
|
13552
|
+
return buildItem("Close to the Right", close, () => {
|
|
13553
|
+
group.panels.filter((_, i) => i > index).forEach((p) => p.api.close());
|
|
13554
|
+
}, index === -1 || index >= group.panels.length - 1);
|
|
13555
|
+
}
|
|
13556
|
+
case "maximize": return this.buildMaximizeItem(panel, close);
|
|
13557
|
+
case "float": return buildItem("Float", close, () => this.accessor.api.addFloatingGroup(panel), panel.api.location.type === "floating");
|
|
13558
|
+
case "popout": return buildItem("Open in New Window", close, () => {
|
|
13559
|
+
this.accessor.api.addPopoutGroup(panel);
|
|
13560
|
+
}, panel.api.location.type === "popout");
|
|
13561
|
+
case "pin": return buildItem(panel.api.isPinned ? "Unpin tab" : "Pin tab", close, () => panel.api.setPinned(!panel.api.isPinned));
|
|
13562
|
+
default: return;
|
|
13563
|
+
}
|
|
13564
|
+
}
|
|
13565
|
+
/**
|
|
13566
|
+
* Append one app-supplied item. A raw `element` is used as-is, a
|
|
13567
|
+
* `component` goes through the framework renderer, and a `label` builds the
|
|
13568
|
+
* default row; an item carrying none of the three renders nothing. Shared
|
|
13569
|
+
* by both menus, which differ only in `identity`.
|
|
13570
|
+
*/
|
|
13571
|
+
appendConfigItem(menuEl, item, identity, group, close) {
|
|
13572
|
+
if (item.element) menuEl.appendChild(item.element);
|
|
13573
|
+
else if (item.component) this.appendComponentItem(menuEl, item, identity, group, close);
|
|
13574
|
+
else if (item.label) menuEl.appendChild(buildItem(item.label, close, () => {
|
|
13575
|
+
var _item$action;
|
|
13576
|
+
return (_item$action = item.action) === null || _item$action === void 0 ? void 0 : _item$action.call(item);
|
|
13577
|
+
}, item.disabled));
|
|
13578
|
+
}
|
|
13579
|
+
show(panel, group, event) {
|
|
13580
|
+
const items = this._resolveTabItems(panel, group, event);
|
|
13581
|
+
if (items.length === 0) return;
|
|
13582
|
+
event.preventDefault();
|
|
13583
|
+
const popupService = this.accessor.getPopupServiceForGroup(group);
|
|
13584
|
+
const close = () => popupService.close();
|
|
13585
|
+
const menuEl = document.createElement("div");
|
|
13586
|
+
menuEl.className = "dv-context-menu";
|
|
13587
|
+
menuEl.setAttribute("role", "menu");
|
|
13588
|
+
for (const item of items) {
|
|
13589
|
+
if (isItemConfig(item)) {
|
|
13590
|
+
this.appendConfigItem(menuEl, item, { panel }, group, close);
|
|
13591
|
+
continue;
|
|
13592
|
+
}
|
|
13593
|
+
const el = this.buildBuiltInTabItem(item, panel, group, close);
|
|
13594
|
+
if (el) menuEl.appendChild(el);
|
|
13595
|
+
}
|
|
13596
|
+
popupService.openPopover(menuEl, {
|
|
13597
|
+
x: event.clientX,
|
|
13598
|
+
y: event.clientY,
|
|
13599
|
+
zIndex: popoverZIndexFor(event.target, group)
|
|
13600
|
+
});
|
|
13601
|
+
}
|
|
13602
|
+
showForChip(tabGroup, group, event) {
|
|
13603
|
+
if (!this.accessor.options.getTabGroupChipContextMenuItems) return;
|
|
13604
|
+
const items = this.accessor.options.getTabGroupChipContextMenuItems({
|
|
13605
|
+
tabGroup,
|
|
13606
|
+
group,
|
|
13607
|
+
api: this.accessor.api,
|
|
13608
|
+
event
|
|
13609
|
+
});
|
|
13610
|
+
if (items.length === 0) return;
|
|
13611
|
+
event.preventDefault();
|
|
13612
|
+
const popupService = this.accessor.getPopupServiceForGroup(group);
|
|
13613
|
+
const close = () => popupService.close();
|
|
13614
|
+
const menuEl = document.createElement("div");
|
|
13615
|
+
menuEl.className = "dv-context-menu";
|
|
13616
|
+
menuEl.setAttribute("role", "menu");
|
|
13617
|
+
for (const item of items) if (item === "separator") menuEl.appendChild(buildSeparator());
|
|
13618
|
+
else if (item === "rename") menuEl.appendChild(buildRenameInput(tabGroup));
|
|
13619
|
+
else if (item === "colorPicker") menuEl.appendChild(buildColorPicker(tabGroup, this.accessor.tabGroupColorPalette));
|
|
13620
|
+
else if (item === "collapse") menuEl.appendChild(this.buildCollapseItem(tabGroup, close));
|
|
13621
|
+
else if (item === "close") menuEl.appendChild(buildItem("Close All", close, () => {
|
|
13622
|
+
group.panels.filter((p) => tabGroup.containsPanel(p.id)).forEach((p) => p.api.close());
|
|
13623
|
+
}));
|
|
13624
|
+
else if (isItemConfig(item)) this.appendConfigItem(menuEl, item, { tabGroup }, group, close);
|
|
13625
|
+
popupService.openPopover(menuEl, {
|
|
13626
|
+
x: event.clientX,
|
|
13627
|
+
y: event.clientY,
|
|
13628
|
+
zIndex: popoverZIndexFor(event.target, group)
|
|
13629
|
+
});
|
|
13630
|
+
}
|
|
13631
|
+
};
|
|
13632
|
+
const ContextMenuModule = defineModule({
|
|
13633
|
+
name: "ContextMenu",
|
|
13634
|
+
serviceKey: "contextMenuService",
|
|
13635
|
+
create: (host) => new ContextMenuController(host)
|
|
13636
|
+
});
|
|
13367
13637
|
/**
|
|
13368
13638
|
* Internal list of the built-in modules that ship with the core. Registered
|
|
13369
13639
|
* automatically by DockviewComponent at construction time; not exported from
|
|
@@ -13379,7 +13649,8 @@ react_dom = __toESM(react_dom);
|
|
|
13379
13649
|
HeaderActionsModule,
|
|
13380
13650
|
LiveRegionModule,
|
|
13381
13651
|
AdvancedDnDModule,
|
|
13382
|
-
TabGroupChipsModule
|
|
13652
|
+
TabGroupChipsModule,
|
|
13653
|
+
ContextMenuModule
|
|
13383
13654
|
];
|
|
13384
13655
|
var PositionCache = class {
|
|
13385
13656
|
constructor() {
|
|
@@ -14050,6 +14321,14 @@ react_dom = __toESM(react_dom);
|
|
|
14050
14321
|
}
|
|
14051
14322
|
};
|
|
14052
14323
|
var DropTargetAnchorContainer = class extends CompositeDisposable {
|
|
14324
|
+
/**
|
|
14325
|
+
* The element the live overlay was rendered for, `undefined` when nothing
|
|
14326
|
+
* is showing. The container is shared by every drop target, so a caller
|
|
14327
|
+
* tearing down only its own overlay must check this before `clear()`.
|
|
14328
|
+
*/
|
|
14329
|
+
get renderedOutline() {
|
|
14330
|
+
return this._model ? this._outline : void 0;
|
|
14331
|
+
}
|
|
14053
14332
|
get disabled() {
|
|
14054
14333
|
return this._disabled;
|
|
14055
14334
|
}
|
|
@@ -14351,6 +14630,10 @@ react_dom = __toESM(react_dom);
|
|
|
14351
14630
|
const index = position === "top" ? this._topIndex : this._bottomIndex;
|
|
14352
14631
|
if (index !== void 0) this._splitview.resizeView(index, size);
|
|
14353
14632
|
}
|
|
14633
|
+
/** The inner splitview's primary-axis (height) extent; zero until laid out. */
|
|
14634
|
+
get axisSize() {
|
|
14635
|
+
return this._splitview.size;
|
|
14636
|
+
}
|
|
14354
14637
|
updateMargin(gap) {
|
|
14355
14638
|
this._splitview.margin = gap;
|
|
14356
14639
|
}
|
|
@@ -14363,6 +14646,7 @@ react_dom = __toESM(react_dom);
|
|
|
14363
14646
|
constructor(container, dockviewElement, layoutGrid, gap = 0, defaultCollapsedSize = 35) {
|
|
14364
14647
|
this._disposables = new CompositeDisposable();
|
|
14365
14648
|
this._viewConfigs = /* @__PURE__ */ new Map();
|
|
14649
|
+
this._pendingSizes = /* @__PURE__ */ new Map();
|
|
14366
14650
|
this._currentWidth = 0;
|
|
14367
14651
|
this._currentHeight = 0;
|
|
14368
14652
|
this._gap = gap;
|
|
@@ -14453,11 +14737,13 @@ react_dom = __toESM(react_dom);
|
|
|
14453
14737
|
break;
|
|
14454
14738
|
}
|
|
14455
14739
|
this._disposables.addDisposables(view);
|
|
14740
|
+
if (!view.isCollapsed && !this._canResize(position)) this._pendingSizes.set(position, initialSize);
|
|
14456
14741
|
this.updateTheme(this._gap, this._defaultCollapsedSize);
|
|
14457
14742
|
return view;
|
|
14458
14743
|
}
|
|
14459
14744
|
layout(width, height) {
|
|
14460
14745
|
this._outerSplitview.layout(width, height);
|
|
14746
|
+
this._flushPendingSizes();
|
|
14461
14747
|
}
|
|
14462
14748
|
/**
|
|
14463
14749
|
* Called when the active theme changes. Updates splitview margins and
|
|
@@ -14521,6 +14807,7 @@ react_dom = __toESM(react_dom);
|
|
|
14521
14807
|
this._disposables.removeDisposable(view);
|
|
14522
14808
|
view.dispose();
|
|
14523
14809
|
this._viewConfigs.delete(position);
|
|
14810
|
+
this._pendingSizes.delete(position);
|
|
14524
14811
|
this.updateTheme(this._gap, this._defaultCollapsedSize);
|
|
14525
14812
|
}
|
|
14526
14813
|
hasEdgeGroup(position) {
|
|
@@ -14544,6 +14831,7 @@ react_dom = __toESM(react_dom);
|
|
|
14544
14831
|
this._middleColumn.setViewVisible(position, visible);
|
|
14545
14832
|
break;
|
|
14546
14833
|
}
|
|
14834
|
+
if (visible) this._flushPendingSizes();
|
|
14547
14835
|
}
|
|
14548
14836
|
isEdgeGroupVisible(position) {
|
|
14549
14837
|
switch (position) {
|
|
@@ -14561,20 +14849,63 @@ react_dom = __toESM(react_dom);
|
|
|
14561
14849
|
const view = this._getView(position);
|
|
14562
14850
|
if (!view) return;
|
|
14563
14851
|
view.setCollapsed(collapsed);
|
|
14564
|
-
|
|
14852
|
+
if (collapsed) {
|
|
14853
|
+
this._pendingSizes.delete(position);
|
|
14854
|
+
this._resizeView(position, view.collapsedSize);
|
|
14855
|
+
} else this.resizeEdgeGroup(position, view.lastExpandedSize);
|
|
14856
|
+
}
|
|
14857
|
+
/**
|
|
14858
|
+
* Resize the edge group at `position` along its primary axis (width for
|
|
14859
|
+
* `left`/`right`, height for `top`/`bottom`), clamped by the group's
|
|
14860
|
+
* constraints and the space available. Where `groupApi.setSize` lands.
|
|
14861
|
+
*
|
|
14862
|
+
* The size becomes the group's expanded size, so a collapsed group keeps
|
|
14863
|
+
* its strip and takes it on expand, and it survives a `toJSON` round-trip.
|
|
14864
|
+
*/
|
|
14865
|
+
resizeEdgeGroup(position, size) {
|
|
14866
|
+
const view = this._getView(position);
|
|
14867
|
+
if (!view || !Number.isFinite(size)) return;
|
|
14868
|
+
const target = Math.round(size);
|
|
14869
|
+
if (target <= 0) return;
|
|
14870
|
+
view.restoreExpandedSize(target);
|
|
14871
|
+
if (view.isCollapsed) {
|
|
14872
|
+
this._pendingSizes.delete(position);
|
|
14873
|
+
return;
|
|
14874
|
+
}
|
|
14875
|
+
if (this._canResize(position)) {
|
|
14876
|
+
this._pendingSizes.delete(position);
|
|
14877
|
+
this._resizeView(position, target);
|
|
14878
|
+
} else this._pendingSizes.set(position, target);
|
|
14879
|
+
}
|
|
14880
|
+
/** A resize lands only on a visible view (a hidden one is pinned to zero)
|
|
14881
|
+
* whose splitview has extent to distribute. */
|
|
14882
|
+
_canResize(position) {
|
|
14883
|
+
if (!this.isEdgeGroupVisible(position)) return false;
|
|
14884
|
+
return (position === "left" || position === "right" ? this._outerSplitview.size : this._middleColumn.axisSize) > 0;
|
|
14885
|
+
}
|
|
14886
|
+
_resizeView(position, size) {
|
|
14565
14887
|
switch (position) {
|
|
14566
14888
|
case "left":
|
|
14567
|
-
if (this._leftIndex !== void 0) this._outerSplitview.resizeView(this._leftIndex,
|
|
14889
|
+
if (this._leftIndex !== void 0) this._outerSplitview.resizeView(this._leftIndex, size);
|
|
14568
14890
|
break;
|
|
14569
14891
|
case "right":
|
|
14570
|
-
if (this._rightIndex !== void 0) this._outerSplitview.resizeView(this._rightIndex,
|
|
14892
|
+
if (this._rightIndex !== void 0) this._outerSplitview.resizeView(this._rightIndex, size);
|
|
14571
14893
|
break;
|
|
14572
14894
|
case "top":
|
|
14573
14895
|
case "bottom":
|
|
14574
|
-
this._middleColumn.resizeView(position,
|
|
14896
|
+
this._middleColumn.resizeView(position, size);
|
|
14575
14897
|
break;
|
|
14576
14898
|
}
|
|
14577
14899
|
}
|
|
14900
|
+
_flushPendingSizes() {
|
|
14901
|
+
if (this._pendingSizes.size === 0) return;
|
|
14902
|
+
for (const [position, size] of this._pendingSizes) {
|
|
14903
|
+
const view = this._getView(position);
|
|
14904
|
+
if (!view || view.isCollapsed || !this._canResize(position)) continue;
|
|
14905
|
+
this._pendingSizes.delete(position);
|
|
14906
|
+
this._resizeView(position, size);
|
|
14907
|
+
}
|
|
14908
|
+
}
|
|
14578
14909
|
isEdgeGroupCollapsed(position) {
|
|
14579
14910
|
var _this$_getView$isColl, _this$_getView;
|
|
14580
14911
|
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;
|
|
@@ -14600,15 +14931,17 @@ react_dom = __toESM(react_dom);
|
|
|
14600
14931
|
maximumSize: Number.isFinite(view.configuredMaximumSize) ? view.configuredMaximumSize : void 0,
|
|
14601
14932
|
collapsedSize: view.configuredCollapsedSize
|
|
14602
14933
|
});
|
|
14603
|
-
const expandedSize = (view, isVisible, liveSize, cachedVisibleSize) => {
|
|
14934
|
+
const expandedSize = (view, position, isVisible, liveSize, cachedVisibleSize) => {
|
|
14604
14935
|
if (view.isCollapsed) return view.lastExpandedSize;
|
|
14936
|
+
const pending = this._pendingSizes.get(position);
|
|
14937
|
+
if (pending !== void 0) return pending;
|
|
14605
14938
|
if (!isVisible) return cachedVisibleSize !== null && cachedVisibleSize !== void 0 ? cachedVisibleSize : view.lastExpandedSize;
|
|
14606
14939
|
return liveSize;
|
|
14607
14940
|
};
|
|
14608
14941
|
if (this._leftView && this._leftIndex !== void 0) {
|
|
14609
14942
|
const visible = this._outerSplitview.isViewVisible(this._leftIndex);
|
|
14610
14943
|
edgeGroups.left = _objectSpread2$1({
|
|
14611
|
-
size: expandedSize(this._leftView, visible, this._outerSplitview.getViewSize(this._leftIndex), this._outerSplitview.getViewCachedVisibleSize(this._leftIndex)),
|
|
14944
|
+
size: expandedSize(this._leftView, "left", visible, this._outerSplitview.getViewSize(this._leftIndex), this._outerSplitview.getViewCachedVisibleSize(this._leftIndex)),
|
|
14612
14945
|
visible,
|
|
14613
14946
|
collapsed: this._leftView.isCollapsed || void 0
|
|
14614
14947
|
}, constraints(this._leftView));
|
|
@@ -14616,7 +14949,7 @@ react_dom = __toESM(react_dom);
|
|
|
14616
14949
|
if (this._rightView && this._rightIndex !== void 0) {
|
|
14617
14950
|
const visible = this._outerSplitview.isViewVisible(this._rightIndex);
|
|
14618
14951
|
edgeGroups.right = _objectSpread2$1({
|
|
14619
|
-
size: expandedSize(this._rightView, visible, this._outerSplitview.getViewSize(this._rightIndex), this._outerSplitview.getViewCachedVisibleSize(this._rightIndex)),
|
|
14952
|
+
size: expandedSize(this._rightView, "right", visible, this._outerSplitview.getViewSize(this._rightIndex), this._outerSplitview.getViewCachedVisibleSize(this._rightIndex)),
|
|
14620
14953
|
visible,
|
|
14621
14954
|
collapsed: this._rightView.isCollapsed || void 0
|
|
14622
14955
|
}, constraints(this._rightView));
|
|
@@ -14624,7 +14957,7 @@ react_dom = __toESM(react_dom);
|
|
|
14624
14957
|
if (this._topView) {
|
|
14625
14958
|
const visible = this._middleColumn.isViewVisible("top");
|
|
14626
14959
|
edgeGroups.top = _objectSpread2$1({
|
|
14627
|
-
size: expandedSize(this._topView, visible, this._middleColumn.getViewSize("top"), this._middleColumn.getViewCachedVisibleSize("top")),
|
|
14960
|
+
size: expandedSize(this._topView, "top", visible, this._middleColumn.getViewSize("top"), this._middleColumn.getViewCachedVisibleSize("top")),
|
|
14628
14961
|
visible,
|
|
14629
14962
|
collapsed: this._topView.isCollapsed || void 0
|
|
14630
14963
|
}, constraints(this._topView));
|
|
@@ -14632,7 +14965,7 @@ react_dom = __toESM(react_dom);
|
|
|
14632
14965
|
if (this._bottomView) {
|
|
14633
14966
|
const visible = this._middleColumn.isViewVisible("bottom");
|
|
14634
14967
|
edgeGroups.bottom = _objectSpread2$1({
|
|
14635
|
-
size: expandedSize(this._bottomView, visible, this._middleColumn.getViewSize("bottom"), this._middleColumn.getViewCachedVisibleSize("bottom")),
|
|
14968
|
+
size: expandedSize(this._bottomView, "bottom", visible, this._middleColumn.getViewSize("bottom"), this._middleColumn.getViewCachedVisibleSize("bottom")),
|
|
14636
14969
|
visible,
|
|
14637
14970
|
collapsed: this._bottomView.isCollapsed || void 0
|
|
14638
14971
|
}, constraints(this._bottomView));
|
|
@@ -14640,33 +14973,23 @@ react_dom = __toESM(react_dom);
|
|
|
14640
14973
|
return edgeGroups;
|
|
14641
14974
|
}
|
|
14642
14975
|
fromJSON(data) {
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
|
|
14646
|
-
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
(
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
if (
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
(_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);
|
|
14661
|
-
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);
|
|
14662
|
-
if (!data.top.visible) this._middleColumn.setViewVisible("top", false);
|
|
14663
|
-
}
|
|
14664
|
-
if (data.bottom) {
|
|
14665
|
-
var _this$_bottomView2, _this$_bottomView3, _data$bottom$collapse, _this$_bottomView$col, _this$_bottomView4;
|
|
14666
|
-
(_this$_bottomView2 = this._bottomView) === null || _this$_bottomView2 === void 0 || _this$_bottomView2.restoreExpandedSize(data.bottom.size);
|
|
14667
|
-
(_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);
|
|
14668
|
-
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);
|
|
14669
|
-
if (!data.bottom.visible) this._middleColumn.setViewVisible("bottom", false);
|
|
14976
|
+
for (const position of [
|
|
14977
|
+
"left",
|
|
14978
|
+
"right",
|
|
14979
|
+
"top",
|
|
14980
|
+
"bottom"
|
|
14981
|
+
]) {
|
|
14982
|
+
var _state$collapsed;
|
|
14983
|
+
const state = data[position];
|
|
14984
|
+
const view = this._getView(position);
|
|
14985
|
+
if (!state || !view) continue;
|
|
14986
|
+
view.restoreExpandedSize(state.size);
|
|
14987
|
+
view.setCollapsed((_state$collapsed = state.collapsed) !== null && _state$collapsed !== void 0 ? _state$collapsed : false);
|
|
14988
|
+
if (state.collapsed) {
|
|
14989
|
+
this._pendingSizes.delete(position);
|
|
14990
|
+
this._resizeView(position, view.collapsedSize);
|
|
14991
|
+
} else this.resizeEdgeGroup(position, state.size);
|
|
14992
|
+
this.setEdgeGroupVisible(position, !!state.visible);
|
|
14670
14993
|
}
|
|
14671
14994
|
}
|
|
14672
14995
|
dispose() {
|
|
@@ -16048,6 +16371,13 @@ react_dom = __toESM(react_dom);
|
|
|
16048
16371
|
position
|
|
16049
16372
|
};
|
|
16050
16373
|
group.model.headerPosition = position;
|
|
16374
|
+
const resizeDisposable = group.onDidChange((event) => {
|
|
16375
|
+
var _this$_shellManager3;
|
|
16376
|
+
if (!event) return;
|
|
16377
|
+
const size = position === "left" || position === "right" ? event.width : event.height;
|
|
16378
|
+
if (typeof size !== "number") return;
|
|
16379
|
+
(_this$_shellManager3 = this._shellManager) === null || _this$_shellManager3 === void 0 || _this$_shellManager3.resizeEdgeGroup(position, size);
|
|
16380
|
+
});
|
|
16051
16381
|
const autoCollapseDisposable = group.model.onDidRemovePanel(() => {
|
|
16052
16382
|
if (!group.model.isEmpty) return;
|
|
16053
16383
|
if (service.isAutoReveal(group)) queueMicrotask(() => {
|
|
@@ -16056,7 +16386,7 @@ react_dom = __toESM(react_dom);
|
|
|
16056
16386
|
});
|
|
16057
16387
|
else this.setEdgeGroupCollapsed(group, true);
|
|
16058
16388
|
});
|
|
16059
|
-
service.add(position, group, autoCollapseDisposable);
|
|
16389
|
+
service.add(position, group, new CompositeDisposable(autoCollapseDisposable, resizeDisposable));
|
|
16060
16390
|
if (options.autoHide !== void 0) service.setAutoHide(group, options.autoHide);
|
|
16061
16391
|
if (options.autoReveal !== void 0) service.setAutoReveal(group, options.autoReveal);
|
|
16062
16392
|
this._onDidAddGroup.fire(group);
|
|
@@ -16151,8 +16481,8 @@ react_dom = __toESM(react_dom);
|
|
|
16151
16481
|
}
|
|
16152
16482
|
/** The size an edge group expands to (pre-collapse); sizes the peek. */
|
|
16153
16483
|
getEdgeGroupExpandedSize(position) {
|
|
16154
|
-
var _this$_shellManager$g, _this$
|
|
16155
|
-
return (_this$_shellManager$g = (_this$
|
|
16484
|
+
var _this$_shellManager$g, _this$_shellManager4;
|
|
16485
|
+
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;
|
|
16156
16486
|
}
|
|
16157
16487
|
/** Reposition a single `renderer:'always'` panel's overlay over its
|
|
16158
16488
|
* reference container, optionally forcing it visible (the auto-hide peek
|
|
@@ -17313,7 +17643,7 @@ react_dom = __toESM(react_dom);
|
|
|
17313
17643
|
}));
|
|
17314
17644
|
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
17315
17645
|
const updatedTargetLocation = getRelativeLocation(destinationGridview.orientation, getGridLocation(destinationGroup.element), destinationTarget);
|
|
17316
|
-
const newGroup = this.createGroupAtLocation(updatedTargetLocation,
|
|
17646
|
+
const newGroup = this.createGroupAtLocation(updatedTargetLocation, this.dropSizing(getGridLocation(destinationGroup.element)), void 0, destinationGridview);
|
|
17317
17647
|
this.movingLock(() => newGroup.model.openPanel(removedPanel, { skipSetActive: true }));
|
|
17318
17648
|
this.doSetGroupAndPanelActive(newGroup);
|
|
17319
17649
|
this.fireDidMovePanel(this.getGroupPanel(sourceItemId), sourceGroup);
|
|
@@ -17330,7 +17660,7 @@ react_dom = __toESM(react_dom);
|
|
|
17330
17660
|
skipSetActiveGroup: true
|
|
17331
17661
|
}));
|
|
17332
17662
|
if (!removedPanel) throw new Error(`dockview: No panel with id ${sourceItemId}`);
|
|
17333
|
-
const newGroup = this.createGroupAtLocation(targetLocation,
|
|
17663
|
+
const newGroup = this.createGroupAtLocation(targetLocation, this.dropSizing(referenceLocation), void 0, destinationGridview);
|
|
17334
17664
|
this.movingLock(() => newGroup.model.openPanel(removedPanel, { skipSetGroupActive: true }));
|
|
17335
17665
|
this.doSetGroupAndPanelActive(newGroup);
|
|
17336
17666
|
this.fireDidMovePanel(removedPanel, sourceGroup);
|
|
@@ -17342,7 +17672,7 @@ react_dom = __toESM(react_dom);
|
|
|
17342
17672
|
}));
|
|
17343
17673
|
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
17344
17674
|
const location = getRelativeLocation(destinationGridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
17345
|
-
this.movingLock(() => this.doAddGroup(targetGroup, location,
|
|
17675
|
+
this.movingLock(() => this.doAddGroup(targetGroup, location, this.dropSizing(updatedReferenceLocation), destinationGridview));
|
|
17346
17676
|
this.setGroupLocationForRoot(targetGroup, destinationGridview);
|
|
17347
17677
|
this.doSetGroupAndPanelActive(targetGroup);
|
|
17348
17678
|
this.fireDidMovePanel(this.getGroupPanel(sourceItemId), sourceGroup);
|
|
@@ -17357,7 +17687,7 @@ react_dom = __toESM(react_dom);
|
|
|
17357
17687
|
}));
|
|
17358
17688
|
if (!removedPanel) throw new Error(`dockview: No panel with id ${sourceItemId}`);
|
|
17359
17689
|
const dropLocation = getRelativeLocation(destinationGridview.orientation, referenceLocation, destinationTarget);
|
|
17360
|
-
const group = this.createGroupAtLocation(dropLocation,
|
|
17690
|
+
const group = this.createGroupAtLocation(dropLocation, this.dropSizing(referenceLocation), void 0, destinationGridview);
|
|
17361
17691
|
this.movingLock(() => group.model.openPanel(removedPanel, { skipSetGroupActive: true }));
|
|
17362
17692
|
this.doSetGroupAndPanelActive(group);
|
|
17363
17693
|
this.fireDidMovePanel(removedPanel, sourceGroup);
|
|
@@ -17401,7 +17731,7 @@ react_dom = __toESM(react_dom);
|
|
|
17401
17731
|
if (!destinationTarget || destinationTarget === "center" || !referenceLocation) targetGroup = destinationGroup;
|
|
17402
17732
|
else {
|
|
17403
17733
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
17404
|
-
targetGroup = this.createGroupAtLocation(dropLocation);
|
|
17734
|
+
targetGroup = this.createGroupAtLocation(dropLocation, this.dropSizing(referenceLocation));
|
|
17405
17735
|
}
|
|
17406
17736
|
if (!options.keepEmptyGroups && sourceGroup.model.size === 0 && sourceGroup !== targetGroup) this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
17407
17737
|
addPanelsToGroup(targetGroup);
|
|
@@ -17452,6 +17782,21 @@ react_dom = __toESM(react_dom);
|
|
|
17452
17782
|
if (options.skipSetActive !== true) this.doSetGroupAndPanelActive(to);
|
|
17453
17783
|
else if (!this.activePanel) this.doSetGroupAndPanelActive(to);
|
|
17454
17784
|
} else {
|
|
17785
|
+
const isReorderWithinBranch = (() => {
|
|
17786
|
+
if (from.api.location.type === "edge" || to.api.location.type === "edge") return false;
|
|
17787
|
+
const root = this.getGridviewForGroup(from);
|
|
17788
|
+
if (root !== this.getGridviewForGroup(to)) return false;
|
|
17789
|
+
let fromLocation;
|
|
17790
|
+
let toLocation;
|
|
17791
|
+
try {
|
|
17792
|
+
fromLocation = getGridLocation(from.element);
|
|
17793
|
+
toLocation = getGridLocation(to.element);
|
|
17794
|
+
} catch (_unused) {
|
|
17795
|
+
return false;
|
|
17796
|
+
}
|
|
17797
|
+
if (fromLocation.length === 0 || toLocation.length === 0) return false;
|
|
17798
|
+
return sequenceEquals(tail(fromLocation)[0], tail(toLocation)[0]) && getLocationOrientation(root.orientation, toLocation) === getDirectionOrientation(target);
|
|
17799
|
+
})();
|
|
17455
17800
|
if (from.api.location.type === "edge") {
|
|
17456
17801
|
/**
|
|
17457
17802
|
* Edge groups are permanent structural elements and must
|
|
@@ -17517,13 +17862,10 @@ react_dom = __toESM(react_dom);
|
|
|
17517
17862
|
const referenceLocation = getGridLocation(to.element);
|
|
17518
17863
|
const dropLocation = getRelativeLocation(destGridview.orientation, referenceLocation, target);
|
|
17519
17864
|
let size;
|
|
17520
|
-
|
|
17521
|
-
|
|
17522
|
-
|
|
17523
|
-
|
|
17524
|
-
case "HORIZONTAL":
|
|
17525
|
-
size = referenceLocation.length % 2 == 0 ? from.api.height : from.api.width;
|
|
17526
|
-
break;
|
|
17865
|
+
if (isReorderWithinBranch) size = getDirectionOrientation(target) === "HORIZONTAL" ? from.api.width : from.api.height;
|
|
17866
|
+
else {
|
|
17867
|
+
var _referenceLocation;
|
|
17868
|
+
size = Sizing.Split((_referenceLocation = referenceLocation[referenceLocation.length - 1]) !== null && _referenceLocation !== void 0 ? _referenceLocation : 0);
|
|
17527
17869
|
}
|
|
17528
17870
|
destGridview.addView(source, size, dropLocation);
|
|
17529
17871
|
this.setGroupLocationForRoot(source, destGridview);
|
|
@@ -17648,6 +17990,16 @@ react_dom = __toESM(react_dom);
|
|
|
17648
17990
|
});
|
|
17649
17991
|
return panel;
|
|
17650
17992
|
}
|
|
17993
|
+
/**
|
|
17994
|
+
* Sizing for a group created by a drop next to `referenceLocation`: half
|
|
17995
|
+
* of the group the overlay was drawn over, leaving its siblings alone, so
|
|
17996
|
+
* the panel lands in the region the overlay indicated (#1612). Gridview
|
|
17997
|
+
* rewrites the index to 0 when a cross-axis drop wraps the reference in a
|
|
17998
|
+
* new branch, so one value serves both paths.
|
|
17999
|
+
*/
|
|
18000
|
+
dropSizing(referenceLocation) {
|
|
18001
|
+
return Sizing.Split(referenceLocation.length === 0 ? 0 : referenceLocation[referenceLocation.length - 1]);
|
|
18002
|
+
}
|
|
17651
18003
|
createGroupAtLocation(location, size, options, gridview = this.gridview) {
|
|
17652
18004
|
const group = this.createGroup(options);
|
|
17653
18005
|
this.doAddGroup(group, location, size, gridview);
|
|
@@ -17707,22 +18059,22 @@ react_dom = __toESM(react_dom);
|
|
|
17707
18059
|
return location.length % 2 == 1 ? rootOrientation : orthogonal(rootOrientation);
|
|
17708
18060
|
}
|
|
17709
18061
|
updateTheme() {
|
|
17710
|
-
var _this$_options$theme, _this$_shellThemeClas, _theme$gap, _this$_popoutWindowSe23, _this$_popoutWindowSe24, _this$
|
|
18062
|
+
var _this$_options$theme, _this$_shellThemeClas, _theme$gap, _this$_popoutWindowSe23, _this$_popoutWindowSe24, _this$_shellManager5, _theme$edgeGroupColla, _theme$tabGroupIndica;
|
|
17711
18063
|
const theme = (_this$_options$theme = this._options.theme) !== null && _this$_options$theme !== void 0 ? _this$_options$theme : themeAbyss;
|
|
17712
18064
|
(_this$_shellThemeClas = this._shellThemeClassnames) === null || _this$_shellThemeClas === void 0 || _this$_shellThemeClas.setClassNames(theme.className);
|
|
17713
18065
|
const gap = (_theme$gap = theme.gap) !== null && _theme$gap !== void 0 ? _theme$gap : 0;
|
|
17714
18066
|
this.gridview.margin = gap;
|
|
17715
18067
|
for (const floating of this.floatingGroups) floating.gridview.margin = gap;
|
|
17716
18068
|
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;
|
|
17717
|
-
(_this$
|
|
18069
|
+
(_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);
|
|
17718
18070
|
if (theme.dndOverlayBorder === void 0) {
|
|
17719
|
-
var _this$
|
|
18071
|
+
var _this$_shellManager6;
|
|
17720
18072
|
this.element.style.removeProperty("--dv-drag-over-border");
|
|
17721
|
-
(_this$
|
|
18073
|
+
(_this$_shellManager6 = this._shellManager) === null || _this$_shellManager6 === void 0 || _this$_shellManager6.element.style.removeProperty("--dv-drag-over-border");
|
|
17722
18074
|
} else {
|
|
17723
|
-
var _this$
|
|
18075
|
+
var _this$_shellManager7;
|
|
17724
18076
|
this.element.style.setProperty("--dv-drag-over-border", theme.dndOverlayBorder);
|
|
17725
|
-
(_this$
|
|
18077
|
+
(_this$_shellManager7 = this._shellManager) === null || _this$_shellManager7 === void 0 || _this$_shellManager7.element.style.setProperty("--dv-drag-over-border", theme.dndOverlayBorder);
|
|
17726
18078
|
}
|
|
17727
18079
|
switch (theme.dndOverlayMounting) {
|
|
17728
18080
|
case "absolute":
|
|
@@ -19576,6 +19928,8 @@ exports.AdvancedDnDModule = AdvancedDnDModule;
|
|
|
19576
19928
|
exports.AdvancedDnDService = AdvancedDnDService;
|
|
19577
19929
|
exports.BaseGrid = BaseGrid;
|
|
19578
19930
|
exports.ContentContainer = ContentContainer;
|
|
19931
|
+
exports.ContextMenuController = ContextMenuController;
|
|
19932
|
+
exports.ContextMenuModule = ContextMenuModule;
|
|
19579
19933
|
exports.DEFAULT_TAB_GROUP_COLORS = DEFAULT_TAB_GROUP_COLORS;
|
|
19580
19934
|
exports.DefaultDockviewDeserialzier = DefaultDockviewDeserialzier;
|
|
19581
19935
|
exports.DefaultTab = DefaultTab;
|