dockview-react 8.6.0 → 8.6.1
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.6.
|
|
3
|
+
* @version 8.6.1
|
|
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.6.
|
|
54
|
+
* @version 8.6.1
|
|
55
55
|
* @link https://github.com/dockview/dockview
|
|
56
56
|
* @license MIT
|
|
57
57
|
*/
|
|
@@ -2259,12 +2259,20 @@ react_dom = __toESM(react_dom);
|
|
|
2259
2259
|
if (candiateNode instanceof BranchNode) return findLeaf(candiateNode.children[last ? candiateNode.children.length - 1 : 0], last);
|
|
2260
2260
|
throw new Error("invalid node");
|
|
2261
2261
|
}
|
|
2262
|
+
/**
|
|
2263
|
+
* The sizing to re-add a branch's child with, so a hidden child stays hidden
|
|
2264
|
+
* (with its cached size) instead of coming back visible at size 0.
|
|
2265
|
+
*/
|
|
2266
|
+
function childSizing(node, index, size, scale = 1) {
|
|
2267
|
+
const cachedVisibleSize = node.getChildCachedVisibleSize(index);
|
|
2268
|
+
return cachedVisibleSize === void 0 ? size : Sizing.Invisible(Math.round(cachedVisibleSize * scale));
|
|
2269
|
+
}
|
|
2262
2270
|
function cloneNode(node, size, orthogonalSize) {
|
|
2263
2271
|
if (node instanceof BranchNode) {
|
|
2264
2272
|
const result = new BranchNode(node.orientation, node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled, node.margin);
|
|
2265
2273
|
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
2266
2274
|
const child = node.children[i];
|
|
2267
|
-
result.addChild(cloneNode(child, child.size, child.orthogonalSize), child.size, 0, true);
|
|
2275
|
+
result.addChild(cloneNode(child, child.size, child.orthogonalSize), childSizing(node, i, child.size), 0, true);
|
|
2268
2276
|
}
|
|
2269
2277
|
return result;
|
|
2270
2278
|
} else return new LeafNode(node.view, node.orientation, orthogonalSize);
|
|
@@ -2273,13 +2281,14 @@ react_dom = __toESM(react_dom);
|
|
|
2273
2281
|
if (node instanceof BranchNode) {
|
|
2274
2282
|
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled, node.margin);
|
|
2275
2283
|
let totalSize = 0;
|
|
2284
|
+
const cachedSizeScale = node.size === 0 ? 1 : size / node.size;
|
|
2276
2285
|
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
2277
2286
|
const child = node.children[i];
|
|
2278
2287
|
const childSize = child instanceof BranchNode ? child.orthogonalSize : child.size;
|
|
2279
2288
|
let newSize = node.size === 0 ? 0 : Math.round(size * childSize / node.size);
|
|
2280
2289
|
totalSize += newSize;
|
|
2281
2290
|
if (i === 0) newSize += size - totalSize;
|
|
2282
|
-
result.addChild(flipNode(child, orthogonalSize, newSize), newSize, 0, true);
|
|
2291
|
+
result.addChild(flipNode(child, orthogonalSize, newSize), childSizing(node, i, newSize, cachedSizeScale), 0, true);
|
|
2283
2292
|
}
|
|
2284
2293
|
return result;
|
|
2285
2294
|
} else return new LeafNode(node.view, orthogonal(node.orientation), orthogonalSize);
|
|
@@ -2765,7 +2774,8 @@ react_dom = __toESM(react_dom);
|
|
|
2765
2774
|
sizes.splice(parentIndex, 1, ...sibling.children.map((c) => c.size));
|
|
2766
2775
|
for (let i = 0; i < sibling.children.length; i++) {
|
|
2767
2776
|
const child = sibling.children[i];
|
|
2768
|
-
|
|
2777
|
+
const childSize = childSizing(sibling, i, child.size);
|
|
2778
|
+
grandParent.addChild(child, !isSiblingVisible && typeof childSize === "number" ? Sizing.Invisible(childSize) : childSize, parentIndex + i);
|
|
2769
2779
|
}
|
|
2770
2780
|
/**
|
|
2771
2781
|
* clean down the branch node since we need to dipose of it and
|
|
@@ -5937,6 +5947,9 @@ react_dom = __toESM(react_dom);
|
|
|
5937
5947
|
get element() {
|
|
5938
5948
|
return this._element;
|
|
5939
5949
|
}
|
|
5950
|
+
get dimensions() {
|
|
5951
|
+
return this._dimensions;
|
|
5952
|
+
}
|
|
5940
5953
|
constructor(accessor, group) {
|
|
5941
5954
|
var _this$accessor$resolv, _this$accessor, _this$accessor$resolv2, _this$accessor2, _this$accessor$onDidO, _this$accessor$onDidO2, _this$accessor3;
|
|
5942
5955
|
super();
|
|
@@ -5947,12 +5960,14 @@ react_dom = __toESM(react_dom);
|
|
|
5947
5960
|
this.onDidFocus = this._onDidFocus.event;
|
|
5948
5961
|
this._onDidBlur = new Emitter();
|
|
5949
5962
|
this.onDidBlur = this._onDidBlur.event;
|
|
5963
|
+
this._onDidDimensionsChange = new Emitter();
|
|
5964
|
+
this.onDidDimensionsChange = this._onDidDimensionsChange.event;
|
|
5950
5965
|
this._element = document.createElement("div");
|
|
5951
5966
|
this._element.className = "dv-content-container";
|
|
5952
5967
|
this._element.tabIndex = -1;
|
|
5953
5968
|
this._element.id = nextContentId();
|
|
5954
5969
|
this._element.setAttribute("role", "tabpanel");
|
|
5955
|
-
this.addDisposables(this._onDidFocus, this._onDidBlur);
|
|
5970
|
+
this.addDisposables(this._onDidFocus, this._onDidBlur, this._onDidDimensionsChange);
|
|
5956
5971
|
const getOverrideTarget = () => {
|
|
5957
5972
|
var _group$dropTargetCont;
|
|
5958
5973
|
return (_group$dropTargetCont = group.dropTargetContainer) === null || _group$dropTargetCont === void 0 ? void 0 : _group$dropTargetCont.model;
|
|
@@ -6061,7 +6076,15 @@ react_dom = __toESM(react_dom);
|
|
|
6061
6076
|
if (this.panel === panel) return;
|
|
6062
6077
|
this.renderPanel(panel);
|
|
6063
6078
|
}
|
|
6064
|
-
layout(
|
|
6079
|
+
layout(width, height) {
|
|
6080
|
+
var _this$_dimensions;
|
|
6081
|
+
if (((_this$_dimensions = this._dimensions) === null || _this$_dimensions === void 0 ? void 0 : _this$_dimensions.width) === width && this._dimensions.height === height) return;
|
|
6082
|
+
this._dimensions = {
|
|
6083
|
+
width,
|
|
6084
|
+
height
|
|
6085
|
+
};
|
|
6086
|
+
this._onDidDimensionsChange.fire(this._dimensions);
|
|
6087
|
+
}
|
|
6065
6088
|
closePanel() {
|
|
6066
6089
|
if (this.panel) {
|
|
6067
6090
|
if (this.panel.api.renderer === "onlyWhenVisible") {
|
|
@@ -10526,7 +10549,6 @@ react_dom = __toESM(react_dom);
|
|
|
10526
10549
|
return (_this$_headerPosition = this._headerPosition) !== null && _this$_headerPosition !== void 0 ? _this$_headerPosition : "top";
|
|
10527
10550
|
}
|
|
10528
10551
|
set headerPosition(value) {
|
|
10529
|
-
var _this$_activePanel;
|
|
10530
10552
|
this._headerPosition = value;
|
|
10531
10553
|
this.invalidateHeaderSize();
|
|
10532
10554
|
removeClasses(this.container, "dv-groupview-header-top", "dv-groupview-header-bottom", "dv-groupview-header-left", "dv-groupview-header-right");
|
|
@@ -10536,10 +10558,7 @@ react_dom = __toESM(react_dom);
|
|
|
10536
10558
|
this._headerDirection = direction;
|
|
10537
10559
|
this.tabsContainer.direction = direction;
|
|
10538
10560
|
this.header.direction = direction;
|
|
10539
|
-
if (
|
|
10540
|
-
const { width, height } = this.contentDimensions();
|
|
10541
|
-
this._activePanel.layout(width, height);
|
|
10542
|
-
}
|
|
10561
|
+
if (this.panels.length > 0) this.layoutContent();
|
|
10543
10562
|
this.updateHeaderActions();
|
|
10544
10563
|
if (previousDirection !== void 0 && previousDirection !== direction) {
|
|
10545
10564
|
var _this$groupPanel;
|
|
@@ -11042,10 +11061,7 @@ react_dom = __toESM(react_dom);
|
|
|
11042
11061
|
this.panels.forEach((panel) => {
|
|
11043
11062
|
this.rerender(panel);
|
|
11044
11063
|
});
|
|
11045
|
-
if (this.
|
|
11046
|
-
const { width, height } = this.contentDimensions();
|
|
11047
|
-
this._activePanel.layout(width, height);
|
|
11048
|
-
}
|
|
11064
|
+
if (this.panels.length > 0) this.layoutContent();
|
|
11049
11065
|
}
|
|
11050
11066
|
get renderContainer() {
|
|
11051
11067
|
var _this$_overwriteRende;
|
|
@@ -11092,10 +11108,10 @@ react_dom = __toESM(react_dom);
|
|
|
11092
11108
|
return this.tabsContainer.indexOf(panel.id);
|
|
11093
11109
|
}
|
|
11094
11110
|
toJSON() {
|
|
11095
|
-
var _this$
|
|
11111
|
+
var _this$_activePanel;
|
|
11096
11112
|
const result = {
|
|
11097
11113
|
views: this.tabsContainer.panels,
|
|
11098
|
-
activeView: (_this$
|
|
11114
|
+
activeView: (_this$_activePanel = this._activePanel) === null || _this$_activePanel === void 0 ? void 0 : _this$_activePanel.id,
|
|
11099
11115
|
id: this.id
|
|
11100
11116
|
};
|
|
11101
11117
|
if (this.locked !== false) result.locked = this.locked;
|
|
@@ -11133,8 +11149,8 @@ react_dom = __toESM(react_dom);
|
|
|
11133
11149
|
init(_params) {}
|
|
11134
11150
|
update(_params) {}
|
|
11135
11151
|
focus() {
|
|
11136
|
-
var _this$
|
|
11137
|
-
(_this$
|
|
11152
|
+
var _this$_activePanel2;
|
|
11153
|
+
(_this$_activePanel2 = this._activePanel) === null || _this$_activePanel2 === void 0 || _this$_activePanel2.focus();
|
|
11138
11154
|
}
|
|
11139
11155
|
openPanel(panel, options = {}) {
|
|
11140
11156
|
if (typeof options.index !== "number" || options.index > this.panels.length) options.index = this.panels.length;
|
|
@@ -11192,12 +11208,24 @@ react_dom = __toESM(react_dom);
|
|
|
11192
11208
|
this.updateContainer();
|
|
11193
11209
|
}
|
|
11194
11210
|
layout(width, height) {
|
|
11195
|
-
var _this$_activePanel4;
|
|
11196
11211
|
this._width = width;
|
|
11197
11212
|
this._height = height;
|
|
11198
|
-
|
|
11199
|
-
|
|
11200
|
-
|
|
11213
|
+
this.layoutContent();
|
|
11214
|
+
}
|
|
11215
|
+
/**
|
|
11216
|
+
* Apply the current content box (group box minus header extent) to the
|
|
11217
|
+
* content container and the active panel. Every path that can change that
|
|
11218
|
+
* box goes through here so the container's recorded dimensions, which size
|
|
11219
|
+
* overlay-rendered panels, never lag the active panel's. Callers other
|
|
11220
|
+
* than `layout()` skip it for a group with no panels: there is nothing to
|
|
11221
|
+
* size, and measuring the header of a group that is not in the document
|
|
11222
|
+
* yet (the constructor sets `headerPosition`) would cache a zero extent.
|
|
11223
|
+
*/
|
|
11224
|
+
layoutContent() {
|
|
11225
|
+
var _this$_activePanel3;
|
|
11226
|
+
const { width, height } = this.contentDimensions();
|
|
11227
|
+
this.contentContainer.layout(width, height);
|
|
11228
|
+
if ((_this$_activePanel3 = this._activePanel) === null || _this$_activePanel3 === void 0 ? void 0 : _this$_activePanel3.layout) this._activePanel.layout(width, height);
|
|
11201
11229
|
}
|
|
11202
11230
|
/**
|
|
11203
11231
|
* Re-run the group's layout with its current dimensions. Used to propagate a
|
|
@@ -11290,8 +11318,7 @@ react_dom = __toESM(react_dom);
|
|
|
11290
11318
|
this.tabsContainer.setActivePanel(panel);
|
|
11291
11319
|
this.contentContainer.setLabelledBy(this.tabsContainer.getTabId(panel.id));
|
|
11292
11320
|
this.contentContainer.openPanel(panel);
|
|
11293
|
-
|
|
11294
|
-
panel.layout(width, height);
|
|
11321
|
+
this.layoutContent();
|
|
11295
11322
|
this.updateMru(panel);
|
|
11296
11323
|
this.contentContainer.refreshFocusState();
|
|
11297
11324
|
this._onDidActivePanelChange.fire({
|
|
@@ -11303,8 +11330,8 @@ react_dom = __toESM(react_dom);
|
|
|
11303
11330
|
}
|
|
11304
11331
|
/** Label the group region with its active panel's title (the WAI-ARIA region name). */
|
|
11305
11332
|
updateAccessibleLabel() {
|
|
11306
|
-
var _this$
|
|
11307
|
-
const title = (_this$
|
|
11333
|
+
var _this$_activePanel4;
|
|
11334
|
+
const title = (_this$_activePanel4 = this._activePanel) === null || _this$_activePanel4 === void 0 ? void 0 : _this$_activePanel4.title;
|
|
11308
11335
|
if (title) this.container.setAttribute("aria-label", title);
|
|
11309
11336
|
else this.container.removeAttribute("aria-label");
|
|
11310
11337
|
}
|
|
@@ -14350,6 +14377,15 @@ react_dom = __toESM(react_dom);
|
|
|
14350
14377
|
element.tabIndex = -1;
|
|
14351
14378
|
return element;
|
|
14352
14379
|
}
|
|
14380
|
+
/**
|
|
14381
|
+
* Write an inline pixel length only when it differs from what is already set,
|
|
14382
|
+
* so a pass that re-derives geometry already in place leaves the element's
|
|
14383
|
+
* style clean and the next measurement does not relayout the overlay subtree.
|
|
14384
|
+
*/
|
|
14385
|
+
function setPixels(style, property, value) {
|
|
14386
|
+
const next = `${value}px`;
|
|
14387
|
+
if (style[property] !== next) style[property] = next;
|
|
14388
|
+
}
|
|
14353
14389
|
var OverlayRenderContainer = class extends CompositeDisposable {
|
|
14354
14390
|
constructor(element, accessor) {
|
|
14355
14391
|
super();
|
|
@@ -14468,6 +14504,32 @@ react_dom = __toESM(react_dom);
|
|
|
14468
14504
|
const generation = mapEntry.generation;
|
|
14469
14505
|
const focusContainer = mapEntry.element;
|
|
14470
14506
|
const contentElement = panel.view.content.element;
|
|
14507
|
+
/**
|
|
14508
|
+
* Size the overlay from the layout engine's numbers (the content box
|
|
14509
|
+
* the group model also hands to `panel.layout()`): a style write with
|
|
14510
|
+
* no forced layout, so the content has its real box before anything
|
|
14511
|
+
* can measure it, and `.dv-render-overlay`'s 100%/100% default is never
|
|
14512
|
+
* observed. Hidden panels are sized too: their content is laid out
|
|
14513
|
+
* (hidden by `visibility`) and must not keep the root's box.
|
|
14514
|
+
*
|
|
14515
|
+
* Only while the overlay is not on screen at a measured position,
|
|
14516
|
+
* i.e. hidden or not yet positioned. Once it is, the frame pass owns
|
|
14517
|
+
* the whole box: size and position must change together, and group
|
|
14518
|
+
* layouts driven from an animation frame would otherwise paint one
|
|
14519
|
+
* frame at the new size and the old position. Likewise not while the
|
|
14520
|
+
* peek force-shows the overlay, whose geometry belongs to
|
|
14521
|
+
* `repositionPanelOverlay`: the collapsed group's own layouts describe
|
|
14522
|
+
* the strip, not the peek. A zero box (a container awaiting layout) is
|
|
14523
|
+
* skipped too: whether 0x0 is a real collapse is the frame pass's call.
|
|
14524
|
+
*/
|
|
14525
|
+
const applySize = (size) => {
|
|
14526
|
+
if (!size || size.width <= 0 || size.height <= 0) return;
|
|
14527
|
+
const entry = this.map[panel.api.id];
|
|
14528
|
+
if (!entry || entry.forceVisible || entry.positioned && panel.api.isVisible) return;
|
|
14529
|
+
setPixels(focusContainer.style, "width", size.width);
|
|
14530
|
+
setPixels(focusContainer.style, "height", size.height);
|
|
14531
|
+
};
|
|
14532
|
+
applySize(referenceContainer.dimensions);
|
|
14471
14533
|
if (contentElement.parentElement !== focusContainer) focusContainer.appendChild(contentElement);
|
|
14472
14534
|
if (focusContainer.parentElement !== this.element) this.element.appendChild(focusContainer);
|
|
14473
14535
|
const resize = () => {
|
|
@@ -14507,10 +14569,10 @@ react_dom = __toESM(react_dom);
|
|
|
14507
14569
|
}
|
|
14508
14570
|
entry.retainPreviousGeometry = false;
|
|
14509
14571
|
entry.positioned = true;
|
|
14510
|
-
focusContainer.style
|
|
14511
|
-
focusContainer.style
|
|
14512
|
-
focusContainer.style
|
|
14513
|
-
focusContainer.style
|
|
14572
|
+
setPixels(focusContainer.style, "left", left);
|
|
14573
|
+
setPixels(focusContainer.style, "top", top);
|
|
14574
|
+
setPixels(focusContainer.style, "width", width);
|
|
14575
|
+
setPixels(focusContainer.style, "height", height);
|
|
14514
14576
|
if (panel.api.isVisible || forceVisible) {
|
|
14515
14577
|
focusContainer.style.visibility = "";
|
|
14516
14578
|
focusContainer.style.pointerEvents = "";
|
|
@@ -14626,6 +14688,9 @@ react_dom = __toESM(react_dom);
|
|
|
14626
14688
|
if (!panel.api.isVisible) return;
|
|
14627
14689
|
resize();
|
|
14628
14690
|
}),
|
|
14691
|
+
referenceContainer.onDidDimensionsChange((size) => {
|
|
14692
|
+
applySize(size);
|
|
14693
|
+
}),
|
|
14629
14694
|
panel.api.onDidLocationChange(() => {
|
|
14630
14695
|
correctLayerPosition();
|
|
14631
14696
|
})
|