dockview 1.7.5 → 1.7.6
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.amd.js +45 -26
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.noStyle.js +45 -26
- package/dist/dockview.cjs.js +45 -26
- package/dist/dockview.esm.js +45 -26
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.js +45 -26
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.noStyle.js +45 -26
- package/package.json +3 -3
package/dist/dockview.amd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 1.7.
|
|
3
|
+
* @version 1.7.6
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -940,7 +940,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
940
940
|
//add sash
|
|
941
941
|
const sash = document.createElement('div');
|
|
942
942
|
sash.className = 'sash';
|
|
943
|
-
const
|
|
943
|
+
const onPointerStart = (event) => {
|
|
944
944
|
for (const item of this.viewItems) {
|
|
945
945
|
item.enabled = false;
|
|
946
946
|
}
|
|
@@ -999,11 +999,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
999
999
|
size: snappedViewItem.size,
|
|
1000
1000
|
};
|
|
1001
1001
|
}
|
|
1002
|
-
|
|
1003
|
-
const mousemove = (mousemoveEvent) => {
|
|
1002
|
+
const onPointerMove = (event) => {
|
|
1004
1003
|
const current = this._orientation === exports.Orientation.HORIZONTAL
|
|
1005
|
-
?
|
|
1006
|
-
:
|
|
1004
|
+
? event.clientX
|
|
1005
|
+
: event.clientY;
|
|
1007
1006
|
const delta = current - start;
|
|
1008
1007
|
this.resize(sashIndex, delta, sizes, undefined, undefined, minDelta, maxDelta, snapBefore, snapAfter);
|
|
1009
1008
|
this.distributeEmptySpace();
|
|
@@ -1017,18 +1016,20 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1017
1016
|
iframe.style.pointerEvents = 'auto';
|
|
1018
1017
|
}
|
|
1019
1018
|
this.saveProportions();
|
|
1020
|
-
document.removeEventListener('
|
|
1021
|
-
document.removeEventListener('
|
|
1019
|
+
document.removeEventListener('pointermove', onPointerMove);
|
|
1020
|
+
document.removeEventListener('pointerup', end);
|
|
1021
|
+
document.removeEventListener('pointercancel', end);
|
|
1022
1022
|
this._onDidSashEnd.fire(undefined);
|
|
1023
1023
|
};
|
|
1024
|
-
document.addEventListener('
|
|
1025
|
-
document.addEventListener('
|
|
1024
|
+
document.addEventListener('pointermove', onPointerMove);
|
|
1025
|
+
document.addEventListener('pointerup', end);
|
|
1026
|
+
document.addEventListener('pointercancel', end);
|
|
1026
1027
|
};
|
|
1027
|
-
sash.addEventListener('
|
|
1028
|
+
sash.addEventListener('pointerdown', onPointerStart);
|
|
1028
1029
|
const sashItem = {
|
|
1029
1030
|
container: sash,
|
|
1030
1031
|
disposable: () => {
|
|
1031
|
-
sash.removeEventListener('
|
|
1032
|
+
sash.removeEventListener('pointerdown', onPointerStart);
|
|
1032
1033
|
this.sashContainer.removeChild(sash);
|
|
1033
1034
|
},
|
|
1034
1035
|
};
|
|
@@ -2121,52 +2122,70 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2121
2122
|
if (!(parent instanceof BranchNode)) {
|
|
2122
2123
|
throw new Error('Invalid location');
|
|
2123
2124
|
}
|
|
2124
|
-
const
|
|
2125
|
-
if (!(
|
|
2125
|
+
const nodeToRemove = parent.children[index];
|
|
2126
|
+
if (!(nodeToRemove instanceof LeafNode)) {
|
|
2126
2127
|
throw new Error('Invalid location');
|
|
2127
2128
|
}
|
|
2128
2129
|
parent.removeChild(index, sizing);
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2130
|
+
nodeToRemove.dispose();
|
|
2131
|
+
if (parent.children.length !== 1) {
|
|
2132
|
+
return nodeToRemove.view;
|
|
2133
|
+
}
|
|
2134
|
+
// if the parent has only one child and we know the parent is a BranchNode we can make the tree
|
|
2135
|
+
// more efficiently spaced by replacing the parent BranchNode with the child.
|
|
2136
|
+
// if that child is a LeafNode then we simply replace the BranchNode with the child otherwise if the child
|
|
2137
|
+
// is a BranchNode too we should spread it's children into the grandparent.
|
|
2138
|
+
// refer to the remaining child as the sibling
|
|
2135
2139
|
const sibling = parent.children[0];
|
|
2136
2140
|
if (pathToParent.length === 0) {
|
|
2137
|
-
// parent is root
|
|
2141
|
+
// if the parent is root
|
|
2138
2142
|
if (sibling instanceof LeafNode) {
|
|
2139
|
-
|
|
2143
|
+
// if the sibling is a leaf node no action is required
|
|
2144
|
+
return nodeToRemove.view;
|
|
2140
2145
|
}
|
|
2141
|
-
//
|
|
2146
|
+
// otherwise the sibling is a branch node. since the parent is the root and the root has only one child
|
|
2147
|
+
// which is a branch node we can just set this branch node to be the new root node
|
|
2148
|
+
// for good housekeeping we'll removing the sibling from it's existing tree
|
|
2142
2149
|
parent.removeChild(0, sizing);
|
|
2150
|
+
// and set that sibling node to be root
|
|
2143
2151
|
this.root = sibling;
|
|
2144
|
-
return
|
|
2152
|
+
return nodeToRemove.view;
|
|
2145
2153
|
}
|
|
2154
|
+
// otherwise the parent is apart of a large sub-tree
|
|
2146
2155
|
const [grandParent, ..._] = [...pathToParent].reverse();
|
|
2147
2156
|
const [parentIndex, ...__] = [...rest].reverse();
|
|
2148
2157
|
const isSiblingVisible = parent.isChildVisible(0);
|
|
2158
|
+
// either way we need to remove the sibling from it's existing tree
|
|
2149
2159
|
parent.removeChild(0, sizing);
|
|
2160
|
+
// note the sizes of all of the grandparents children
|
|
2150
2161
|
const sizes = grandParent.children.map((_size, i) => grandParent.getChildSize(i));
|
|
2151
|
-
|
|
2162
|
+
// remove the parent from the grandparent since we are moving the sibling to take the parents place
|
|
2163
|
+
// this parent is no longer used and can be disposed of
|
|
2164
|
+
grandParent.removeChild(parentIndex, sizing).dispose();
|
|
2152
2165
|
if (sibling instanceof BranchNode) {
|
|
2166
|
+
// replace the parent with the siblings children
|
|
2153
2167
|
sizes.splice(parentIndex, 1, ...sibling.children.map((c) => c.size));
|
|
2168
|
+
// and add those siblings to the grandparent
|
|
2154
2169
|
for (let i = 0; i < sibling.children.length; i++) {
|
|
2155
2170
|
const child = sibling.children[i];
|
|
2156
2171
|
grandParent.addChild(child, child.size, parentIndex + i);
|
|
2157
2172
|
}
|
|
2158
2173
|
}
|
|
2159
2174
|
else {
|
|
2175
|
+
// otherwise create a new leaf node and add that to the grandparent
|
|
2160
2176
|
const newSibling = new LeafNode(sibling.view, orthogonal(sibling.orientation), sibling.size);
|
|
2161
2177
|
const siblingSizing = isSiblingVisible
|
|
2162
2178
|
? sibling.orthogonalSize
|
|
2163
2179
|
: exports.Sizing.Invisible(sibling.orthogonalSize);
|
|
2164
2180
|
grandParent.addChild(newSibling, siblingSizing, parentIndex);
|
|
2165
2181
|
}
|
|
2182
|
+
// the containing node of the sibling is no longer required and can be disposed of
|
|
2183
|
+
sibling.dispose();
|
|
2184
|
+
// resize everything
|
|
2166
2185
|
for (let i = 0; i < sizes.length; i++) {
|
|
2167
2186
|
grandParent.resizeChild(i, sizes[i]);
|
|
2168
2187
|
}
|
|
2169
|
-
return
|
|
2188
|
+
return nodeToRemove.view;
|
|
2170
2189
|
}
|
|
2171
2190
|
layout(width, height) {
|
|
2172
2191
|
const [size, orthogonalSize] = this.root.orientation === exports.Orientation.HORIZONTAL
|