dockview-core 8.0.0 → 8.1.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/dnd/dataTransfer.d.ts +1 -0
- package/dist/cjs/dockview/advancedDnDService.d.ts +3 -18
- package/dist/cjs/dockview/dockviewComponent.d.ts +9 -5
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +24 -0
- package/dist/cjs/dockview/moduleContracts.d.ts +5 -0
- package/dist/cjs/dockview/options.d.ts +0 -1
- package/dist/cjs/dockview/tabGroup.d.ts +3 -0
- package/dist/cjs/events.d.ts +1 -1
- package/dist/cjs/gridview/branchNode.d.ts +16 -0
- package/dist/cjs/scrollbar.d.ts +10 -0
- package/dist/cjs/splitview/viewItem.d.ts +10 -0
- package/dist/dockview-core.js +276 -154
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.noStyle.js +276 -154
- package/dist/package/main.cjs.js +276 -154
- package/dist/package/main.cjs.min.js +2 -2
- package/dist/package/main.esm.min.mjs +2 -2
- package/dist/package/main.esm.mjs +276 -154
- package/package.json +1 -1
package/dist/package/main.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 8.
|
|
3
|
+
* @version 8.1.0
|
|
4
4
|
* @link https://github.com/dockview/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -8,7 +8,9 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
8
8
|
|
|
9
9
|
//#region src/dnd/dataTransfer.ts
|
|
10
10
|
var _LocalSelectionTransfer;
|
|
11
|
-
var TransferObject = class {
|
|
11
|
+
var TransferObject = class {
|
|
12
|
+
constructor() {}
|
|
13
|
+
};
|
|
12
14
|
var PanelTransfer = class extends TransferObject {
|
|
13
15
|
constructor(viewId, groupId, panelId, tabGroupId) {
|
|
14
16
|
super();
|
|
@@ -201,7 +203,6 @@ var Emitter = class Emitter {
|
|
|
201
203
|
this.options = options;
|
|
202
204
|
this._listeners = [];
|
|
203
205
|
this._disposed = false;
|
|
204
|
-
this._pauseTokens = /* @__PURE__ */ new Set();
|
|
205
206
|
}
|
|
206
207
|
get event() {
|
|
207
208
|
if (!this._event) {
|
|
@@ -222,14 +223,26 @@ var Emitter = class Emitter {
|
|
|
222
223
|
}
|
|
223
224
|
fire(e) {
|
|
224
225
|
var _this$options2;
|
|
225
|
-
if (this._pauseTokens.size > 0) return;
|
|
226
|
+
if (this._pauseTokens !== void 0 && this._pauseTokens.size > 0) return;
|
|
226
227
|
if ((_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.replay) this._last = e;
|
|
227
|
-
|
|
228
|
+
const listeners = this._listeners;
|
|
229
|
+
const length = listeners.length;
|
|
230
|
+
if (length === 0) return;
|
|
231
|
+
if (length === 1) {
|
|
232
|
+
listeners[0].callback(e);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
for (const listener of listeners.slice()) listener.callback(e);
|
|
228
236
|
}
|
|
229
237
|
pause() {
|
|
238
|
+
var _this$_pauseTokens;
|
|
230
239
|
const token = {};
|
|
240
|
+
(_this$_pauseTokens = this._pauseTokens) !== null && _this$_pauseTokens !== void 0 || (this._pauseTokens = /* @__PURE__ */ new Set());
|
|
231
241
|
this._pauseTokens.add(token);
|
|
232
|
-
return Disposable.from(() =>
|
|
242
|
+
return Disposable.from(() => {
|
|
243
|
+
var _this$_pauseTokens2;
|
|
244
|
+
return (_this$_pauseTokens2 = this._pauseTokens) === null || _this$_pauseTokens2 === void 0 ? void 0 : _this$_pauseTokens2.delete(token);
|
|
245
|
+
});
|
|
233
246
|
}
|
|
234
247
|
dispose() {
|
|
235
248
|
if (!this._disposed) {
|
|
@@ -532,8 +545,10 @@ function onDidWindowMoveEnd(window) {
|
|
|
532
545
|
let previousScreenX = window.screenX;
|
|
533
546
|
let previousScreenY = window.screenY;
|
|
534
547
|
let timeout;
|
|
548
|
+
let rafHandle = 0;
|
|
549
|
+
let stopped = false;
|
|
535
550
|
const checkMovement = () => {
|
|
536
|
-
if (window.closed) return;
|
|
551
|
+
if (stopped || window.closed) return;
|
|
537
552
|
const currentScreenX = window.screenX;
|
|
538
553
|
const currentScreenY = window.screenY;
|
|
539
554
|
if (currentScreenX !== previousScreenX || currentScreenY !== previousScreenY) {
|
|
@@ -544,9 +559,18 @@ function onDidWindowMoveEnd(window) {
|
|
|
544
559
|
previousScreenX = currentScreenX;
|
|
545
560
|
previousScreenY = currentScreenY;
|
|
546
561
|
}
|
|
547
|
-
requestAnimationFrame(checkMovement);
|
|
562
|
+
rafHandle = requestAnimationFrame(checkMovement);
|
|
548
563
|
};
|
|
549
564
|
checkMovement();
|
|
565
|
+
const disposeEmitter = emitter.dispose.bind(emitter);
|
|
566
|
+
emitter.dispose = () => {
|
|
567
|
+
if (!stopped) {
|
|
568
|
+
stopped = true;
|
|
569
|
+
cancelAnimationFrame(rafHandle);
|
|
570
|
+
clearTimeout(timeout);
|
|
571
|
+
}
|
|
572
|
+
disposeEmitter();
|
|
573
|
+
};
|
|
550
574
|
return emitter;
|
|
551
575
|
}
|
|
552
576
|
function onDidWindowResizeEnd(element, cb) {
|
|
@@ -682,6 +706,11 @@ var ViewItem = class {
|
|
|
682
706
|
set size(size) {
|
|
683
707
|
this._size = size;
|
|
684
708
|
}
|
|
709
|
+
setContainerGeometry(prop, value) {
|
|
710
|
+
if (this._appliedStyles[prop] === value) return;
|
|
711
|
+
this._appliedStyles[prop] = value;
|
|
712
|
+
this.container.style[prop] = value;
|
|
713
|
+
}
|
|
685
714
|
get size() {
|
|
686
715
|
return this._size;
|
|
687
716
|
}
|
|
@@ -717,6 +746,7 @@ var ViewItem = class {
|
|
|
717
746
|
this.view = view;
|
|
718
747
|
this.disposable = disposable;
|
|
719
748
|
this._cachedVisibleSize = void 0;
|
|
749
|
+
this._appliedStyles = {};
|
|
720
750
|
if (typeof size === "number") {
|
|
721
751
|
this._size = size;
|
|
722
752
|
this._cachedVisibleSize = void 0;
|
|
@@ -765,6 +795,16 @@ let LayoutPriority = /* @__PURE__ */ function(LayoutPriority) {
|
|
|
765
795
|
LayoutPriority["Normal"] = "normal";
|
|
766
796
|
return LayoutPriority;
|
|
767
797
|
}({});
|
|
798
|
+
function setSashPosition(sash, left, top) {
|
|
799
|
+
if (sash.appliedLeft !== left) {
|
|
800
|
+
sash.appliedLeft = left;
|
|
801
|
+
sash.container.style.left = left;
|
|
802
|
+
}
|
|
803
|
+
if (sash.appliedTop !== top) {
|
|
804
|
+
sash.appliedTop = top;
|
|
805
|
+
sash.container.style.top = top;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
768
808
|
let Sizing;
|
|
769
809
|
(function(_Sizing) {
|
|
770
810
|
_Sizing.Distribute = { type: "distribute" };
|
|
@@ -883,10 +923,6 @@ var Splitview = class {
|
|
|
883
923
|
pushToEnd(upIndexes, i);
|
|
884
924
|
pushToEnd(downIndexes, i);
|
|
885
925
|
}
|
|
886
|
-
const upItems = upIndexes.map((i) => this.viewItems[i]);
|
|
887
|
-
const upSizes = upIndexes.map((i) => sizes[i]);
|
|
888
|
-
const downItems = downIndexes.map((i) => this.viewItems[i]);
|
|
889
|
-
const downSizes = downIndexes.map((i) => sizes[i]);
|
|
890
926
|
const minDeltaUp = upIndexes.reduce((_, i) => _ + this.viewItems[i].minimumSize - sizes[i], 0);
|
|
891
927
|
const maxDeltaUp = upIndexes.reduce((_, i) => _ + this.viewItems[i].maximumSize - sizes[i], 0);
|
|
892
928
|
const maxDeltaDown = downIndexes.length === 0 ? Number.POSITIVE_INFINITY : downIndexes.reduce((_, i) => _ + sizes[i] - this.viewItems[i].minimumSize, 0);
|
|
@@ -910,19 +946,21 @@ var Splitview = class {
|
|
|
910
946
|
const tentativeDelta = clamp(delta, minDelta, maxDelta);
|
|
911
947
|
let actualDelta = 0;
|
|
912
948
|
let deltaUp = tentativeDelta;
|
|
913
|
-
for (
|
|
914
|
-
const item =
|
|
915
|
-
const
|
|
916
|
-
const
|
|
949
|
+
for (const upIndex of upIndexes) {
|
|
950
|
+
const item = this.viewItems[upIndex];
|
|
951
|
+
const priorSize = sizes[upIndex];
|
|
952
|
+
const size = clamp(priorSize + deltaUp, item.minimumSize, item.maximumSize);
|
|
953
|
+
const viewDelta = size - priorSize;
|
|
917
954
|
actualDelta += viewDelta;
|
|
918
955
|
deltaUp -= viewDelta;
|
|
919
956
|
item.size = size;
|
|
920
957
|
}
|
|
921
958
|
let deltaDown = actualDelta;
|
|
922
|
-
for (
|
|
923
|
-
const item =
|
|
924
|
-
const
|
|
925
|
-
const
|
|
959
|
+
for (const downIndex of downIndexes) {
|
|
960
|
+
const item = this.viewItems[downIndex];
|
|
961
|
+
const priorSize = sizes[downIndex];
|
|
962
|
+
const size = clamp(priorSize - deltaDown, item.minimumSize, item.maximumSize);
|
|
963
|
+
const viewDelta = size - priorSize;
|
|
926
964
|
deltaDown += viewDelta;
|
|
927
965
|
item.size = size;
|
|
928
966
|
}
|
|
@@ -1170,13 +1208,22 @@ var Splitview = class {
|
|
|
1170
1208
|
this.saveProportions();
|
|
1171
1209
|
}
|
|
1172
1210
|
distributeEmptySpace(lowPriorityIndex) {
|
|
1173
|
-
|
|
1211
|
+
let contentSize = 0;
|
|
1212
|
+
for (const item of this.viewItems) contentSize += item.size;
|
|
1174
1213
|
let emptyDelta = this.size - contentSize;
|
|
1214
|
+
if (emptyDelta === 0) return;
|
|
1175
1215
|
const indexes = range(this.viewItems.length - 1, -1);
|
|
1176
|
-
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1179
|
-
|
|
1216
|
+
let hasPriority = false;
|
|
1217
|
+
for (const item of this.viewItems) if (item.priority === "low" || item.priority === "high") {
|
|
1218
|
+
hasPriority = true;
|
|
1219
|
+
break;
|
|
1220
|
+
}
|
|
1221
|
+
if (hasPriority) {
|
|
1222
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === "low");
|
|
1223
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === "high");
|
|
1224
|
+
for (const index of highPriorityIndexes) pushToStart(indexes, index);
|
|
1225
|
+
for (const index of lowPriorityIndexes) pushToEnd(indexes, index);
|
|
1226
|
+
}
|
|
1180
1227
|
if (typeof lowPriorityIndex === "number") pushToEnd(indexes, lowPriorityIndex);
|
|
1181
1228
|
for (let i = 0; emptyDelta !== 0 && i < indexes.length; i++) {
|
|
1182
1229
|
const item = this.viewItems[indexes[i]];
|
|
@@ -1199,49 +1246,45 @@ var Splitview = class {
|
|
|
1199
1246
|
* For each view `i` the offet must be adjusted by `m * i/(n - 1)`.
|
|
1200
1247
|
*/
|
|
1201
1248
|
layoutViews() {
|
|
1202
|
-
|
|
1249
|
+
let contentSize = 0;
|
|
1250
|
+
let visibleViewCount = 0;
|
|
1251
|
+
for (const item of this.viewItems) {
|
|
1252
|
+
contentSize += item.size;
|
|
1253
|
+
if (item.visible) visibleViewCount++;
|
|
1254
|
+
}
|
|
1255
|
+
this._contentSize = contentSize;
|
|
1203
1256
|
this.updateSashEnablement();
|
|
1204
1257
|
if (this.viewItems.length === 0) return;
|
|
1205
|
-
const
|
|
1206
|
-
const
|
|
1207
|
-
const marginReducedSize = this.margin * sashCount / Math.max(1, visibleViewItems.length);
|
|
1258
|
+
const sashCount = Math.max(0, visibleViewCount - 1);
|
|
1259
|
+
const marginReducedSize = this.margin * sashCount / Math.max(1, visibleViewCount);
|
|
1208
1260
|
let totalLeftOffset = 0;
|
|
1209
1261
|
const viewLeftOffsets = [];
|
|
1210
1262
|
const sashWidth = 4;
|
|
1211
|
-
|
|
1212
|
-
const flag = viewItem.visible ? 1 : 0;
|
|
1213
|
-
if (i === 0) arr.push(flag);
|
|
1214
|
-
else arr.push(arr[i - 1] + flag);
|
|
1215
|
-
return arr;
|
|
1216
|
-
}, []);
|
|
1263
|
+
let runningVisiblePanelCount = 0;
|
|
1217
1264
|
this.viewItems.forEach((view, i) => {
|
|
1218
1265
|
totalLeftOffset += this.viewItems[i].size;
|
|
1219
1266
|
viewLeftOffsets.push(totalLeftOffset);
|
|
1267
|
+
runningVisiblePanelCount += view.visible ? 1 : 0;
|
|
1220
1268
|
const size = view.visible ? view.size - marginReducedSize : 0;
|
|
1221
|
-
const visiblePanelsBeforeThisView = Math.max(0, runningVisiblePanelCount
|
|
1269
|
+
const visiblePanelsBeforeThisView = Math.max(0, runningVisiblePanelCount - 1);
|
|
1222
1270
|
const offset = i === 0 || visiblePanelsBeforeThisView === 0 ? 0 : viewLeftOffsets[i - 1] + visiblePanelsBeforeThisView / sashCount * marginReducedSize;
|
|
1223
1271
|
if (i < this.viewItems.length - 1) {
|
|
1224
1272
|
const newSize = view.visible ? offset + size - sashWidth / 2 + this.margin / 2 : offset;
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
}
|
|
1229
|
-
if (this._orientation === "VERTICAL") {
|
|
1230
|
-
this.sashes[i].container.style.left = `0px`;
|
|
1231
|
-
this.sashes[i].container.style.top = `${newSize}px`;
|
|
1232
|
-
}
|
|
1273
|
+
const sash = this.sashes[i];
|
|
1274
|
+
if (this._orientation === "HORIZONTAL") setSashPosition(sash, `${newSize}px`, `0px`);
|
|
1275
|
+
if (this._orientation === "VERTICAL") setSashPosition(sash, `0px`, `${newSize}px`);
|
|
1233
1276
|
}
|
|
1234
1277
|
if (this._orientation === "HORIZONTAL") {
|
|
1235
|
-
view.
|
|
1236
|
-
view.
|
|
1237
|
-
view.
|
|
1238
|
-
view.
|
|
1278
|
+
view.setContainerGeometry("width", `${size}px`);
|
|
1279
|
+
view.setContainerGeometry("left", `${offset}px`);
|
|
1280
|
+
view.setContainerGeometry("top", "");
|
|
1281
|
+
view.setContainerGeometry("height", "");
|
|
1239
1282
|
}
|
|
1240
1283
|
if (this._orientation === "VERTICAL") {
|
|
1241
|
-
view.
|
|
1242
|
-
view.
|
|
1243
|
-
view.
|
|
1244
|
-
view.
|
|
1284
|
+
view.setContainerGeometry("height", `${size}px`);
|
|
1285
|
+
view.setContainerGeometry("top", `${offset}px`);
|
|
1286
|
+
view.setContainerGeometry("width", "");
|
|
1287
|
+
view.setContainerGeometry("left", "");
|
|
1245
1288
|
}
|
|
1246
1289
|
view.view.layout(view.size - marginReducedSize, this._orthogonalSize);
|
|
1247
1290
|
});
|
|
@@ -1259,6 +1302,7 @@ var Splitview = class {
|
|
|
1259
1302
|
}
|
|
1260
1303
|
}
|
|
1261
1304
|
updateSashEnablement() {
|
|
1305
|
+
if (this.sashes.length === 0) return;
|
|
1262
1306
|
let previous = false;
|
|
1263
1307
|
const collapsesDown = this.viewItems.map((i) => previous = i.size - i.minimumSize > 0 || previous);
|
|
1264
1308
|
previous = false;
|
|
@@ -1565,10 +1609,20 @@ var BranchNode = class BranchNode extends CompositeDisposable {
|
|
|
1565
1609
|
return this.orientation === "HORIZONTAL" ? this.orthogonalSize : this.size;
|
|
1566
1610
|
}
|
|
1567
1611
|
get minimumSize() {
|
|
1568
|
-
|
|
1612
|
+
if (this._cachedMinimumSize === void 0) {
|
|
1613
|
+
let value = 0;
|
|
1614
|
+
for (let index = 0; index < this.children.length; index++) if (this.splitview.isViewVisible(index)) value = Math.max(value, this.children[index].minimumOrthogonalSize);
|
|
1615
|
+
this._cachedMinimumSize = value;
|
|
1616
|
+
}
|
|
1617
|
+
return this._cachedMinimumSize;
|
|
1569
1618
|
}
|
|
1570
1619
|
get maximumSize() {
|
|
1571
|
-
|
|
1620
|
+
if (this._cachedMaximumSize === void 0) {
|
|
1621
|
+
let value = Number.POSITIVE_INFINITY;
|
|
1622
|
+
for (let index = 0; index < this.children.length; index++) if (this.splitview.isViewVisible(index)) value = Math.min(value, this.children[index].maximumOrthogonalSize);
|
|
1623
|
+
this._cachedMaximumSize = value;
|
|
1624
|
+
}
|
|
1625
|
+
return this._cachedMaximumSize;
|
|
1572
1626
|
}
|
|
1573
1627
|
get minimumOrthogonalSize() {
|
|
1574
1628
|
return this.splitview.minimumSize;
|
|
@@ -1595,15 +1649,29 @@ var BranchNode = class BranchNode extends CompositeDisposable {
|
|
|
1595
1649
|
return this.orientation === "HORIZONTAL" ? this.maximumSize : this.maximumOrthogonalSize;
|
|
1596
1650
|
}
|
|
1597
1651
|
get priority() {
|
|
1652
|
+
var _this$_cachedPriority;
|
|
1653
|
+
(_this$_cachedPriority = this._cachedPriority) !== null && _this$_cachedPriority !== void 0 || (this._cachedPriority = this.computePriority());
|
|
1654
|
+
return this._cachedPriority;
|
|
1655
|
+
}
|
|
1656
|
+
computePriority() {
|
|
1598
1657
|
if (this.children.length === 0) return "normal";
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1658
|
+
let hasHigh = false;
|
|
1659
|
+
let hasLow = false;
|
|
1660
|
+
for (const child of this.children) {
|
|
1661
|
+
var _child$priority;
|
|
1662
|
+
const priority = (_child$priority = child.priority) !== null && _child$priority !== void 0 ? _child$priority : "normal";
|
|
1663
|
+
if (priority === "high") hasHigh = true;
|
|
1664
|
+
else if (priority === "low") hasLow = true;
|
|
1665
|
+
}
|
|
1666
|
+
if (hasHigh) return "high";
|
|
1667
|
+
else if (hasLow) return "low";
|
|
1605
1668
|
return "normal";
|
|
1606
1669
|
}
|
|
1670
|
+
invalidateCachedSizes() {
|
|
1671
|
+
this._cachedMinimumSize = void 0;
|
|
1672
|
+
this._cachedMaximumSize = void 0;
|
|
1673
|
+
this._cachedPriority = void 0;
|
|
1674
|
+
}
|
|
1607
1675
|
get disabled() {
|
|
1608
1676
|
return this.splitview.disabled;
|
|
1609
1677
|
}
|
|
@@ -1679,6 +1747,7 @@ var BranchNode = class BranchNode extends CompositeDisposable {
|
|
|
1679
1747
|
if (this.splitview.isViewVisible(index) === visible) return;
|
|
1680
1748
|
const wereAllChildrenHidden = this.splitview.contentSize === 0;
|
|
1681
1749
|
this.splitview.setViewVisible(index, visible);
|
|
1750
|
+
this.invalidateCachedSizes();
|
|
1682
1751
|
const areAllChildrenHidden = this.splitview.contentSize === 0;
|
|
1683
1752
|
if (visible && wereAllChildrenHidden || !visible && areAllChildrenHidden) this._onDidVisibilityChange.fire({ visible });
|
|
1684
1753
|
}
|
|
@@ -1727,12 +1796,14 @@ var BranchNode = class BranchNode extends CompositeDisposable {
|
|
|
1727
1796
|
return child;
|
|
1728
1797
|
}
|
|
1729
1798
|
setupChildrenEvents() {
|
|
1799
|
+
this.invalidateCachedSizes();
|
|
1730
1800
|
this._childrenDisposable.dispose();
|
|
1731
1801
|
this._childrenDisposable = new CompositeDisposable(Event.any(...this.children.map((c) => c.onDidChange))((e) => {
|
|
1732
1802
|
/**
|
|
1733
1803
|
* indicate a change has occured to allows any re-rendering but don't bubble
|
|
1734
1804
|
* event because that was specific to this branch
|
|
1735
1805
|
*/
|
|
1806
|
+
this.invalidateCachedSizes();
|
|
1736
1807
|
this._onDidChange.fire({ size: e.orthogonalSize });
|
|
1737
1808
|
}), ...this.children.map((c, i) => {
|
|
1738
1809
|
if (c instanceof BranchNode) return c.onDidVisibilityChange(({ visible }) => {
|
|
@@ -3409,7 +3480,7 @@ var DockviewApi = class {
|
|
|
3409
3480
|
* Add a group and return the created object.
|
|
3410
3481
|
*/
|
|
3411
3482
|
addGroup(options) {
|
|
3412
|
-
return this.component.addGroup(options);
|
|
3483
|
+
return this.component.withOrigin("api", () => this.component.addGroup(options));
|
|
3413
3484
|
}
|
|
3414
3485
|
/**
|
|
3415
3486
|
* Close all groups and panels.
|
|
@@ -3547,13 +3618,13 @@ var DockviewApi = class {
|
|
|
3547
3618
|
this.activatePrevious(options);
|
|
3548
3619
|
}
|
|
3549
3620
|
maximizeGroup(panel) {
|
|
3550
|
-
this.component.maximizeGroup(panel.group);
|
|
3621
|
+
this.component.withOrigin("api", () => this.component.maximizeGroup(panel.group));
|
|
3551
3622
|
}
|
|
3552
3623
|
hasMaximizedGroup() {
|
|
3553
3624
|
return this.component.hasMaximizedGroup();
|
|
3554
3625
|
}
|
|
3555
3626
|
exitMaximizedGroup() {
|
|
3556
|
-
this.component.exitMaximizedGroup();
|
|
3627
|
+
this.component.withOrigin("api", () => this.component.exitMaximizedGroup());
|
|
3557
3628
|
}
|
|
3558
3629
|
get onDidMaximizedGroupChange() {
|
|
3559
3630
|
return this.component.onDidMaximizedGroupChange;
|
|
@@ -5508,9 +5579,6 @@ var ContentContainer = class extends CompositeDisposable {
|
|
|
5508
5579
|
const doRender = ((_options$asActive = options === null || options === void 0 ? void 0 : options.asActive) !== null && _options$asActive !== void 0 ? _options$asActive : true) || this.panel && this.group.isPanelActive(this.panel);
|
|
5509
5580
|
if (((_this$panel = this.panel) === null || _this$panel === void 0 ? void 0 : _this$panel.view.content.element.parentElement) === this._element) {
|
|
5510
5581
|
var _this$panel$view$cont, _this$panel$view$cont2;
|
|
5511
|
-
/**
|
|
5512
|
-
* If the currently attached panel is mounted directly to the content then remove it
|
|
5513
|
-
*/
|
|
5514
5582
|
this.panel.view.content.element.remove();
|
|
5515
5583
|
(_this$panel$view$cont = (_this$panel$view$cont2 = this.panel.view.content).onHide) === null || _this$panel$view$cont === void 0 || _this$panel$view$cont.call(_this$panel$view$cont2);
|
|
5516
5584
|
}
|
|
@@ -6251,7 +6319,7 @@ var Scrollbar = class Scrollbar extends CompositeDisposable {
|
|
|
6251
6319
|
this.element.appendChild(this._scrollbar);
|
|
6252
6320
|
this.addDisposables(addDisposableListener(this.element, "wheel", (event) => {
|
|
6253
6321
|
this._scrollOffset += event.deltaY * Scrollbar.MouseWheelSpeed;
|
|
6254
|
-
this.
|
|
6322
|
+
this.scheduleStyleUpdate();
|
|
6255
6323
|
}), addDisposableListener(this._scrollbar, "pointerdown", (event) => {
|
|
6256
6324
|
var _this$_scrollbar$owne;
|
|
6257
6325
|
event.preventDefault();
|
|
@@ -6263,7 +6331,7 @@ var Scrollbar = class Scrollbar extends CompositeDisposable {
|
|
|
6263
6331
|
const delta = this._orientation === "horizontal" ? event.clientX - originalClient : event.clientY - originalClient;
|
|
6264
6332
|
const p = (this._orientation === "horizontal" ? this.element.clientWidth : this.element.clientHeight) / (this._orientation === "horizontal" ? this.scrollableElement.scrollWidth : this.scrollableElement.scrollHeight);
|
|
6265
6333
|
this._scrollOffset = originalScrollOffset + delta / p;
|
|
6266
|
-
this.
|
|
6334
|
+
this.scheduleStyleUpdate();
|
|
6267
6335
|
};
|
|
6268
6336
|
const onEnd = () => {
|
|
6269
6337
|
toggleClass(this.element, "dv-scrollable-scrolling", false);
|
|
@@ -6275,10 +6343,10 @@ var Scrollbar = class Scrollbar extends CompositeDisposable {
|
|
|
6275
6343
|
doc.addEventListener("pointerup", onEnd);
|
|
6276
6344
|
doc.addEventListener("pointercancel", onEnd);
|
|
6277
6345
|
}), addDisposableListener(this.element, "scroll", () => {
|
|
6278
|
-
this.
|
|
6346
|
+
this.scheduleStyleUpdate();
|
|
6279
6347
|
}), addDisposableListener(this.scrollableElement, "scroll", () => {
|
|
6280
6348
|
this._scrollOffset = this._orientation === "horizontal" ? this.scrollableElement.scrollLeft : this.scrollableElement.scrollTop;
|
|
6281
|
-
this.
|
|
6349
|
+
this.scheduleStyleUpdate();
|
|
6282
6350
|
}), watchElementResize(this.element, () => {
|
|
6283
6351
|
toggleClass(this.element, "dv-scrollable-resizing", true);
|
|
6284
6352
|
if (this._animationTimer) clearTimeout(this._animationTimer);
|
|
@@ -6286,9 +6354,29 @@ var Scrollbar = class Scrollbar extends CompositeDisposable {
|
|
|
6286
6354
|
clearTimeout(this._animationTimer);
|
|
6287
6355
|
toggleClass(this.element, "dv-scrollable-resizing", false);
|
|
6288
6356
|
}, 500);
|
|
6289
|
-
this.
|
|
6357
|
+
this.scheduleStyleUpdate();
|
|
6358
|
+
}), Disposable.from(() => {
|
|
6359
|
+
if (this._pendingStyleFrame !== void 0) {
|
|
6360
|
+
cancelAnimationFrame(this._pendingStyleFrame);
|
|
6361
|
+
this._pendingStyleFrame = void 0;
|
|
6362
|
+
}
|
|
6290
6363
|
}));
|
|
6291
6364
|
}
|
|
6365
|
+
/**
|
|
6366
|
+
* Coalesce the scrollbar restyle to one pass per animation frame. The
|
|
6367
|
+
* wheel / scroll / pointermove handlers can each fire many times per frame,
|
|
6368
|
+
* and `calculateScrollbarStyles` both reads layout (`clientWidth`/
|
|
6369
|
+
* `scrollWidth`) and writes styles + `scrollLeft`/`scrollTop`; running it
|
|
6370
|
+
* synchronously per event caused repeated read→write→read reflow. Batching
|
|
6371
|
+
* to a frame keeps a burst of events to a single measure+write.
|
|
6372
|
+
*/
|
|
6373
|
+
scheduleStyleUpdate() {
|
|
6374
|
+
if (this._pendingStyleFrame !== void 0) return;
|
|
6375
|
+
this._pendingStyleFrame = requestAnimationFrame(() => {
|
|
6376
|
+
this._pendingStyleFrame = void 0;
|
|
6377
|
+
this.calculateScrollbarStyles();
|
|
6378
|
+
});
|
|
6379
|
+
}
|
|
6292
6380
|
calculateScrollbarStyles() {
|
|
6293
6381
|
const clientSize = this._orientation === "horizontal" ? this.element.clientWidth : this.element.clientHeight;
|
|
6294
6382
|
const scrollSize = this._orientation === "horizontal" ? this.scrollableElement.scrollWidth : this.scrollableElement.scrollHeight;
|
|
@@ -8749,8 +8837,8 @@ var Tabs = class extends CompositeDisposable {
|
|
|
8749
8837
|
}, true), addDisposableListener(this._tabsList, "dragend", () => {
|
|
8750
8838
|
this._reorder.resetDragAnimation();
|
|
8751
8839
|
}), addDisposableListener(this._tabsList, "drop", (event) => {
|
|
8752
|
-
var _this$accessor$option, _this$group$model$dro;
|
|
8753
|
-
if (
|
|
8840
|
+
var _this$_animState3, _this$accessor$option, _this$group$model$dro;
|
|
8841
|
+
if (((_this$_animState3 = this._animState) === null || _this$_animState3 === void 0 ? void 0 : _this$_animState3.currentInsertionIndex) == null) return;
|
|
8754
8842
|
if (((_this$accessor$option = this.accessor.options.theme) === null || _this$accessor$option === void 0 ? void 0 : _this$accessor$option.tabAnimation) !== "smooth" && !this._animState.sourceTabGroupId) return;
|
|
8755
8843
|
event.stopPropagation();
|
|
8756
8844
|
event.preventDefault();
|
|
@@ -8955,7 +9043,7 @@ var Tabs = class extends CompositeDisposable {
|
|
|
8955
9043
|
};
|
|
8956
9044
|
this._pendingCollapse = true;
|
|
8957
9045
|
requestAnimationFrame(() => {
|
|
8958
|
-
var _this$
|
|
9046
|
+
var _this$_animState4, _this$_animState4$cur;
|
|
8959
9047
|
this._pendingCollapse = false;
|
|
8960
9048
|
if (!this._animState) return;
|
|
8961
9049
|
if (!this._tabsList.classList.contains("dv-tabs-container--wrap")) {
|
|
@@ -8963,7 +9051,7 @@ var Tabs = class extends CompositeDisposable {
|
|
|
8963
9051
|
toggleClass(tab.element, "dv-tab--dragging", true);
|
|
8964
9052
|
tab.element.offsetHeight;
|
|
8965
9053
|
}
|
|
8966
|
-
(_this$
|
|
9054
|
+
(_this$_animState4$cur = (_this$_animState4 = this._animState).currentInsertionIndex) !== null && _this$_animState4$cur !== void 0 || (_this$_animState4.currentInsertionIndex = sourceIndex);
|
|
8967
9055
|
this.applyDragOverTransforms(true);
|
|
8968
9056
|
tab.element.style.removeProperty("transition");
|
|
8969
9057
|
});
|
|
@@ -9052,8 +9140,8 @@ var Tabs = class extends CompositeDisposable {
|
|
|
9052
9140
|
}
|
|
9053
9141
|
}
|
|
9054
9142
|
delete(id) {
|
|
9055
|
-
var _this$
|
|
9056
|
-
if (((_this$
|
|
9143
|
+
var _this$_animState5;
|
|
9144
|
+
if (((_this$_animState5 = this._animState) === null || _this$_animState5 === void 0 ? void 0 : _this$_animState5.sourceTabId) === id) {
|
|
9057
9145
|
this.resetTabTransforms();
|
|
9058
9146
|
this._animState = null;
|
|
9059
9147
|
}
|
|
@@ -9170,7 +9258,7 @@ var Tabs = class extends CompositeDisposable {
|
|
|
9170
9258
|
const groupPanelIds = new Set(tabGroup.panelIds);
|
|
9171
9259
|
this._pendingCollapse = true;
|
|
9172
9260
|
requestAnimationFrame(() => {
|
|
9173
|
-
var _this$
|
|
9261
|
+
var _this$_animState6, _this$_animState6$cur;
|
|
9174
9262
|
this._pendingCollapse = false;
|
|
9175
9263
|
if (!this._animState) return;
|
|
9176
9264
|
for (const t of this._tabs) if (groupPanelIds.has(t.value.panel.id)) {
|
|
@@ -9185,7 +9273,7 @@ var Tabs = class extends CompositeDisposable {
|
|
|
9185
9273
|
this._tabsList.offsetHeight;
|
|
9186
9274
|
const underline = this._tabGroupManager.groupUnderlines.get(tabGroup.id);
|
|
9187
9275
|
if (underline) underline.style.display = "none";
|
|
9188
|
-
(_this$
|
|
9276
|
+
(_this$_animState6$cur = (_this$_animState6 = this._animState).currentInsertionIndex) !== null && _this$_animState6$cur !== void 0 || (_this$_animState6.currentInsertionIndex = firstIdx);
|
|
9189
9277
|
this.applyDragOverTransforms(true);
|
|
9190
9278
|
for (const t of this._tabs) if (groupPanelIds.has(t.value.panel.id)) t.value.element.style.removeProperty("transition");
|
|
9191
9279
|
if (chipEntry) chipEntry.chip.element.style.removeProperty("transition");
|
|
@@ -9920,6 +10008,7 @@ var DockviewGroupPanelModel = class extends CompositeDisposable {
|
|
|
9920
10008
|
set headerPosition(value) {
|
|
9921
10009
|
var _this$_activePanel;
|
|
9922
10010
|
this._headerPosition = value;
|
|
10011
|
+
this.invalidateHeaderSize();
|
|
9923
10012
|
removeClasses(this.container, "dv-groupview-header-top", "dv-groupview-header-bottom", "dv-groupview-header-left", "dv-groupview-header-right");
|
|
9924
10013
|
addClasses(this.container, `dv-groupview-header-${value}`);
|
|
9925
10014
|
const direction = value === "top" || value === "bottom" ? "horizontal" : "vertical";
|
|
@@ -10061,7 +10150,14 @@ var DockviewGroupPanelModel = class extends CompositeDisposable {
|
|
|
10061
10150
|
this.header.hidden = !!options.hideHeader;
|
|
10062
10151
|
this.locked = (_options$locked = options.locked) !== null && _options$locked !== void 0 ? _options$locked : false;
|
|
10063
10152
|
this.headerPosition = (_options$headerPositi = options.headerPosition) !== null && _options$headerPositi !== void 0 ? _options$headerPositi : accessor.defaultHeaderPosition;
|
|
10064
|
-
this.addDisposables(
|
|
10153
|
+
this.addDisposables(watchElementResize(this.tabsContainer.element, () => {
|
|
10154
|
+
if (this.isDisposed) return;
|
|
10155
|
+
const size = this.measureHeaderSize();
|
|
10156
|
+
if (size !== this._cachedHeaderSize) {
|
|
10157
|
+
this._cachedHeaderSize = size;
|
|
10158
|
+
this.layout(this._width, this._height);
|
|
10159
|
+
}
|
|
10160
|
+
}), this._onDidPanelTitleChange.event(() => this.updateAccessibleLabel()), this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this.tabsContainer.onTabDragStart((event) => {
|
|
10065
10161
|
this._onTabDragStart.fire(event);
|
|
10066
10162
|
}), this.tabsContainer.onGroupDragStart((event) => {
|
|
10067
10163
|
this._onGroupDragStart.fire(event);
|
|
@@ -10518,16 +10614,11 @@ var DockviewGroupPanelModel = class extends CompositeDisposable {
|
|
|
10518
10614
|
(_this$_activePanel3 = this._activePanel) === null || _this$_activePanel3 === void 0 || _this$_activePanel3.focus();
|
|
10519
10615
|
}
|
|
10520
10616
|
openPanel(panel, options = {}) {
|
|
10521
|
-
/**
|
|
10522
|
-
* set the panel group
|
|
10523
|
-
* add the panel
|
|
10524
|
-
* check if group active
|
|
10525
|
-
* check if panel active
|
|
10526
|
-
*/
|
|
10527
10617
|
if (typeof options.index !== "number" || options.index > this.panels.length) options.index = this.panels.length;
|
|
10528
10618
|
const skipSetActive = !!options.skipSetActive;
|
|
10529
10619
|
panel.updateParentGroup(this.groupPanel, { skipSetActive: options.skipSetActive });
|
|
10530
10620
|
this.doAddPanel(panel, options.index, { skipSetActive });
|
|
10621
|
+
this.invalidateHeaderSize();
|
|
10531
10622
|
if (this._activePanel === panel) {
|
|
10532
10623
|
this.contentContainer.renderPanel(panel, { asActive: true });
|
|
10533
10624
|
return;
|
|
@@ -10590,6 +10681,7 @@ var DockviewGroupPanelModel = class extends CompositeDisposable {
|
|
|
10590
10681
|
* changing) down to the content + active panel.
|
|
10591
10682
|
*/
|
|
10592
10683
|
relayout() {
|
|
10684
|
+
this.invalidateHeaderSize();
|
|
10593
10685
|
this.layout(this._width, this._height);
|
|
10594
10686
|
}
|
|
10595
10687
|
/**
|
|
@@ -10599,17 +10691,32 @@ var DockviewGroupPanelModel = class extends CompositeDisposable {
|
|
|
10599
10691
|
* width); a hidden header has `display:none` so its `offset*` is 0 and
|
|
10600
10692
|
* nothing is subtracted.
|
|
10601
10693
|
*/
|
|
10602
|
-
|
|
10694
|
+
/**
|
|
10695
|
+
* Measure the header's extent along its occupied axis. This is the single
|
|
10696
|
+
* forced-reflow read; it now runs only on a cache miss (first layout after
|
|
10697
|
+
* a header change) and inside the header's ResizeObserver — not on every
|
|
10698
|
+
* layout frame.
|
|
10699
|
+
*/
|
|
10700
|
+
measureHeaderSize() {
|
|
10603
10701
|
const headerEl = this.tabsContainer.element;
|
|
10702
|
+
return this.headerPosition === "top" || this.headerPosition === "bottom" ? headerEl.offsetHeight : headerEl.offsetWidth;
|
|
10703
|
+
}
|
|
10704
|
+
invalidateHeaderSize() {
|
|
10705
|
+
this._cachedHeaderSize = void 0;
|
|
10706
|
+
}
|
|
10707
|
+
contentDimensions() {
|
|
10708
|
+
var _this$_cachedHeaderSi;
|
|
10604
10709
|
const horizontal = this.headerPosition === "top" || this.headerPosition === "bottom";
|
|
10710
|
+
const headerSize = (_this$_cachedHeaderSi = this._cachedHeaderSize) !== null && _this$_cachedHeaderSi !== void 0 ? _this$_cachedHeaderSi : this._cachedHeaderSize = this.measureHeaderSize();
|
|
10605
10711
|
return {
|
|
10606
|
-
width: horizontal ? this._width : Math.max(0, this._width -
|
|
10607
|
-
height: horizontal ? Math.max(0, this._height -
|
|
10712
|
+
width: horizontal ? this._width : Math.max(0, this._width - headerSize),
|
|
10713
|
+
height: horizontal ? Math.max(0, this._height - headerSize) : this._height
|
|
10608
10714
|
};
|
|
10609
10715
|
}
|
|
10610
10716
|
_removePanel(panel, options) {
|
|
10611
10717
|
const isActivePanel = this._activePanel === panel;
|
|
10612
10718
|
this.doRemovePanel(panel);
|
|
10719
|
+
this.invalidateHeaderSize();
|
|
10613
10720
|
if (isActivePanel && this.panels.length > 0) {
|
|
10614
10721
|
const nextPanel = this.mostRecentlyUsed[0];
|
|
10615
10722
|
this.openPanel(nextPanel, {
|
|
@@ -10935,6 +11042,7 @@ var GridviewPanel = class extends BasePanelView {
|
|
|
10935
11042
|
if (typeof event.minimumHeight === "number" || typeof event.minimumHeight === "function") this._minimumHeight = event.minimumHeight;
|
|
10936
11043
|
if (typeof event.maximumWidth === "number" || typeof event.maximumWidth === "function") this._maximumWidth = event.maximumWidth;
|
|
10937
11044
|
if (typeof event.maximumHeight === "number" || typeof event.maximumHeight === "function") this._maximumHeight = event.maximumHeight;
|
|
11045
|
+
this._onDidChange.fire(void 0);
|
|
10938
11046
|
}), this.api.onDidSizeChange((event) => {
|
|
10939
11047
|
this._onDidChange.fire({
|
|
10940
11048
|
height: event.height,
|
|
@@ -11054,20 +11162,22 @@ var DockviewGroupPanelApiImpl = class extends GridviewPanelApiImpl {
|
|
|
11054
11162
|
return this._group.model.headerPosition;
|
|
11055
11163
|
}
|
|
11056
11164
|
moveTo(options) {
|
|
11057
|
-
var _options$group, _options$position, _options$skipSetActiv, _options$position2;
|
|
11058
11165
|
if (!this._group) throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
|
|
11070
|
-
|
|
11166
|
+
this.accessor.withOrigin("api", () => {
|
|
11167
|
+
var _options$group, _options$position, _options$skipSetActiv, _options$position2;
|
|
11168
|
+
const group = (_options$group = options.group) !== null && _options$group !== void 0 ? _options$group : this.accessor.addGroup({
|
|
11169
|
+
direction: positionToDirection((_options$position = options.position) !== null && _options$position !== void 0 ? _options$position : "right"),
|
|
11170
|
+
skipSetActive: (_options$skipSetActiv = options.skipSetActive) !== null && _options$skipSetActiv !== void 0 ? _options$skipSetActiv : false
|
|
11171
|
+
});
|
|
11172
|
+
this.accessor.moveGroupOrPanel({
|
|
11173
|
+
from: { groupId: this._group.id },
|
|
11174
|
+
to: {
|
|
11175
|
+
group,
|
|
11176
|
+
position: options.group ? (_options$position2 = options.position) !== null && _options$position2 !== void 0 ? _options$position2 : "center" : "center",
|
|
11177
|
+
index: options.index
|
|
11178
|
+
},
|
|
11179
|
+
skipSetActive: options.skipSetActive
|
|
11180
|
+
});
|
|
11071
11181
|
});
|
|
11072
11182
|
}
|
|
11073
11183
|
maximize() {
|
|
@@ -11416,18 +11526,20 @@ var DockviewPanelApiImpl = class extends GridviewPanelApiImpl {
|
|
|
11416
11526
|
this.accessor.withOrigin("api", () => super.setActive());
|
|
11417
11527
|
}
|
|
11418
11528
|
moveTo(options) {
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
|
|
11529
|
+
this.accessor.withOrigin("api", () => {
|
|
11530
|
+
var _options$group, _options$position;
|
|
11531
|
+
return this.accessor.moveGroupOrPanel({
|
|
11532
|
+
from: {
|
|
11533
|
+
groupId: this._group.id,
|
|
11534
|
+
panelId: this.panel.id
|
|
11535
|
+
},
|
|
11536
|
+
to: {
|
|
11537
|
+
group: (_options$group = options.group) !== null && _options$group !== void 0 ? _options$group : this._group,
|
|
11538
|
+
position: options.group ? (_options$position = options.position) !== null && _options$position !== void 0 ? _options$position : "center" : "center",
|
|
11539
|
+
index: options.index
|
|
11540
|
+
},
|
|
11541
|
+
skipSetActive: options.skipSetActive
|
|
11542
|
+
});
|
|
11431
11543
|
});
|
|
11432
11544
|
}
|
|
11433
11545
|
setTitle(title) {
|
|
@@ -12537,12 +12649,6 @@ const OPTION_MODULE_RULES = [
|
|
|
12537
12649
|
moduleName: "ContextMenu",
|
|
12538
12650
|
when: (o) => o.getTabGroupChipContextMenuItems != null
|
|
12539
12651
|
},
|
|
12540
|
-
{
|
|
12541
|
-
optionKey: "createContextMenuItemComponent",
|
|
12542
|
-
reason: "createContextMenuItemComponent",
|
|
12543
|
-
moduleName: "ContextMenu",
|
|
12544
|
-
when: (o) => o.createContextMenuItemComponent != null
|
|
12545
|
-
},
|
|
12546
12652
|
{
|
|
12547
12653
|
optionKey: "dndCompass",
|
|
12548
12654
|
reason: "dndCompass",
|
|
@@ -13271,7 +13377,18 @@ var LiveRegionService = class extends CompositeDisposable {
|
|
|
13271
13377
|
prev = next;
|
|
13272
13378
|
const panel = group.activePanel;
|
|
13273
13379
|
if (!panel) return;
|
|
13274
|
-
|
|
13380
|
+
let kind;
|
|
13381
|
+
switch (next) {
|
|
13382
|
+
case "floating":
|
|
13383
|
+
kind = "float";
|
|
13384
|
+
break;
|
|
13385
|
+
case "popout":
|
|
13386
|
+
kind = "popout";
|
|
13387
|
+
break;
|
|
13388
|
+
default:
|
|
13389
|
+
kind = "dock";
|
|
13390
|
+
break;
|
|
13391
|
+
}
|
|
13275
13392
|
this._announce(panel, kind);
|
|
13276
13393
|
});
|
|
13277
13394
|
this._locationSubs.set(group.id, sub);
|
|
@@ -13323,29 +13440,14 @@ const LiveRegionModule = defineModule({
|
|
|
13323
13440
|
|
|
13324
13441
|
//#endregion
|
|
13325
13442
|
//#region src/dockview/advancedDnDService.ts
|
|
13326
|
-
/** Cursor offset of the group drag ghost
|
|
13443
|
+
/** Cursor offset of the group drag ghost. */
|
|
13327
13444
|
const GROUP_DRAG_GHOST_OFFSET_X = 30;
|
|
13328
13445
|
const GROUP_DRAG_GHOST_OFFSET_Y = -10;
|
|
13329
13446
|
/**
|
|
13330
|
-
* The narrow surface the {@link AdvancedDnDService} needs from the host
|
|
13331
|
-
* (the `DockviewComponent`).
|
|
13332
|
-
*
|
|
13333
|
-
* The `onWill*` emitters stay on the component so the public event shape is
|
|
13334
|
-
* unchanged whether or not this module is registered; the service is only the
|
|
13335
|
-
* dispatch point those fires are routed through. Engine policy (e.g. the
|
|
13336
|
-
* `disableDnd` guard) stays on the component, ahead of the dispatch.
|
|
13337
|
-
*/
|
|
13338
|
-
/**
|
|
13339
13447
|
* Owns the dispatch of the advanced drag-and-drop hooks: `onWillDragPanel`,
|
|
13340
|
-
* `onWillDragGroup`, `onWillDrop` and `onWillShowOverlay
|
|
13341
|
-
*
|
|
13342
|
-
*
|
|
13343
|
-
* emitters; the customisation surface it gates (custom drop overlays, custom
|
|
13344
|
-
* group drag ghosts, hook veto/transform behaviour) is currently inlined in
|
|
13345
|
-
* core and is extracted into this service in later phases. Routing the
|
|
13346
|
-
* dispatch through a module slot is what lets that customisation layer move
|
|
13347
|
-
* into a separately-distributed package in a future major version without
|
|
13348
|
-
* changing the public event surface.
|
|
13448
|
+
* `onWillDragGroup`, `onWillDrop` and `onWillShowOverlay`, forwarding each to
|
|
13449
|
+
* the host's emitters so the public event shape is unchanged whether or not
|
|
13450
|
+
* this module is registered.
|
|
13349
13451
|
*
|
|
13350
13452
|
* The service holds no drag state of its own. The gesture is driven by the
|
|
13351
13453
|
* DnD backends, and the per-group subscriptions live on the component's group
|
|
@@ -13471,7 +13573,7 @@ const AllModules = [
|
|
|
13471
13573
|
//#region src/overlay/overlayRenderContainer.ts
|
|
13472
13574
|
var PositionCache = class {
|
|
13473
13575
|
constructor() {
|
|
13474
|
-
this.cache = /* @__PURE__ */ new
|
|
13576
|
+
this.cache = /* @__PURE__ */ new WeakMap();
|
|
13475
13577
|
this.currentFrameId = 0;
|
|
13476
13578
|
this.rafId = null;
|
|
13477
13579
|
}
|
|
@@ -15140,7 +15242,22 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
15140
15242
|
const rect = candidate.element.getBoundingClientRect();
|
|
15141
15243
|
const dx = rect.left + rect.width / 2 - fromX;
|
|
15142
15244
|
const dy = rect.top + rect.height / 2 - fromY;
|
|
15143
|
-
|
|
15245
|
+
let inDirection;
|
|
15246
|
+
switch (direction) {
|
|
15247
|
+
case "left":
|
|
15248
|
+
inDirection = dx < 0 && Math.abs(dx) >= Math.abs(dy);
|
|
15249
|
+
break;
|
|
15250
|
+
case "right":
|
|
15251
|
+
inDirection = dx > 0 && Math.abs(dx) >= Math.abs(dy);
|
|
15252
|
+
break;
|
|
15253
|
+
case "up":
|
|
15254
|
+
inDirection = dy < 0 && Math.abs(dy) >= Math.abs(dx);
|
|
15255
|
+
break;
|
|
15256
|
+
default:
|
|
15257
|
+
inDirection = dy > 0 && Math.abs(dy) >= Math.abs(dx);
|
|
15258
|
+
break;
|
|
15259
|
+
}
|
|
15260
|
+
if (!inDirection) continue;
|
|
15144
15261
|
const distance = dx * dx + dy * dy;
|
|
15145
15262
|
if (distance < bestDistance) {
|
|
15146
15263
|
bestDistance = distance;
|
|
@@ -15988,11 +16105,15 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
15988
16105
|
/**
|
|
15989
16106
|
* Reveal (create-or-fill) the edge group at `position` and move the dragged
|
|
15990
16107
|
* item described by `data` into it. A newly created edge group is created
|
|
15991
|
-
* collapsed
|
|
15992
|
-
* later emptied
|
|
15993
|
-
*
|
|
15994
|
-
*
|
|
15995
|
-
*
|
|
16108
|
+
* collapsed, flagged `autoReveal` so it tears down to zero footprint when
|
|
16109
|
+
* later emptied, and takes its auto-hide state from `options.autoHide`. If an
|
|
16110
|
+
* edge group already exists there it is reused: the panel is added to its
|
|
16111
|
+
* tabs and its collapsed/toggled *and auto-hide* state are left as-is (never
|
|
16112
|
+
* re-created; `addEdgeGroup` throws on a duplicate position). This keeps a
|
|
16113
|
+
* drag-reveal from silently converting a static edge group into an
|
|
16114
|
+
* auto-hiding one; to change an existing group's auto-hide, call
|
|
16115
|
+
* `api.getEdgeGroup(position)?.setAutoHide(...)` directly. No-op if the
|
|
16116
|
+
* EdgeGroup module is absent.
|
|
15996
16117
|
*
|
|
15997
16118
|
* This is the primitive behind the dock-to-edge groups: the two-band
|
|
15998
16119
|
* drag-reveal affordance routes its outer-band drops here.
|
|
@@ -16011,7 +16132,7 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
16011
16132
|
collapsed: true
|
|
16012
16133
|
});
|
|
16013
16134
|
group = service.get(position);
|
|
16014
|
-
}
|
|
16135
|
+
}
|
|
16015
16136
|
if (!group) return;
|
|
16016
16137
|
this.moveGroupOrPanel({
|
|
16017
16138
|
from: {
|
|
@@ -16542,6 +16663,7 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
16542
16663
|
height: options.initialHeight
|
|
16543
16664
|
};
|
|
16544
16665
|
let index;
|
|
16666
|
+
const shouldSkipSetActive = (group) => !!options.inactive && group.model.size > 0;
|
|
16545
16667
|
if (options.position) if (isPanelOptionsWithPanel(options.position)) {
|
|
16546
16668
|
const referencePanel = typeof options.position.referencePanel === "string" ? this.getGroupPanel(options.position.referencePanel) : options.position.referencePanel;
|
|
16547
16669
|
index = options.position.index;
|
|
@@ -16564,7 +16686,7 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
16564
16686
|
const group = this.orthogonalize(directionToPosition(options.position.direction));
|
|
16565
16687
|
const panel = this.createPanel(options, group);
|
|
16566
16688
|
group.model.openPanel(panel, {
|
|
16567
|
-
skipSetActive:
|
|
16689
|
+
skipSetActive: shouldSkipSetActive(group),
|
|
16568
16690
|
skipSetGroupActive: options.inactive,
|
|
16569
16691
|
index
|
|
16570
16692
|
});
|
|
@@ -16591,14 +16713,14 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
16591
16713
|
}));
|
|
16592
16714
|
panel = this.createPanel(options, group);
|
|
16593
16715
|
group.model.openPanel(panel, {
|
|
16594
|
-
skipSetActive:
|
|
16716
|
+
skipSetActive: shouldSkipSetActive(group),
|
|
16595
16717
|
skipSetGroupActive: options.inactive,
|
|
16596
16718
|
index
|
|
16597
16719
|
});
|
|
16598
16720
|
} else if (referenceGroup.api.location.type === "floating" || referenceGroup.api.location.type === "edge" || target === "center") {
|
|
16599
16721
|
panel = this.createPanel(options, referenceGroup);
|
|
16600
16722
|
referenceGroup.model.openPanel(panel, {
|
|
16601
|
-
skipSetActive:
|
|
16723
|
+
skipSetActive: shouldSkipSetActive(referenceGroup),
|
|
16602
16724
|
skipSetGroupActive: options.inactive,
|
|
16603
16725
|
index
|
|
16604
16726
|
});
|
|
@@ -16613,7 +16735,7 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
16613
16735
|
const group = this.createGroupAtLocation(relativeLocation, this.orientationAtLocation(relativeLocation) === "VERTICAL" ? initial === null || initial === void 0 ? void 0 : initial.height : initial === null || initial === void 0 ? void 0 : initial.width);
|
|
16614
16736
|
panel = this.createPanel(options, group);
|
|
16615
16737
|
group.model.openPanel(panel, {
|
|
16616
|
-
skipSetActive:
|
|
16738
|
+
skipSetActive: shouldSkipSetActive(group),
|
|
16617
16739
|
skipSetGroupActive: options.inactive,
|
|
16618
16740
|
index
|
|
16619
16741
|
});
|
|
@@ -16630,7 +16752,7 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
16630
16752
|
}));
|
|
16631
16753
|
panel = this.createPanel(options, group);
|
|
16632
16754
|
group.model.openPanel(panel, {
|
|
16633
|
-
skipSetActive:
|
|
16755
|
+
skipSetActive: shouldSkipSetActive(group),
|
|
16634
16756
|
skipSetGroupActive: options.inactive,
|
|
16635
16757
|
index
|
|
16636
16758
|
});
|
|
@@ -16638,7 +16760,7 @@ var DockviewComponent = class extends BaseGrid {
|
|
|
16638
16760
|
const group = this.createGroupAtLocation([0], this.gridview.orientation === "VERTICAL" ? initial === null || initial === void 0 ? void 0 : initial.height : initial === null || initial === void 0 ? void 0 : initial.width);
|
|
16639
16761
|
panel = this.createPanel(options, group);
|
|
16640
16762
|
group.model.openPanel(panel, {
|
|
16641
|
-
skipSetActive:
|
|
16763
|
+
skipSetActive: shouldSkipSetActive(group),
|
|
16642
16764
|
skipSetGroupActive: options.inactive,
|
|
16643
16765
|
index
|
|
16644
16766
|
});
|