dockview 1.7.4 → 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 +65 -50
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.noStyle.js +65 -50
- package/dist/dockview.cjs.js +65 -50
- package/dist/dockview.esm.js +65 -50
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.js +65 -50
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.noStyle.js +65 -50
- package/package.json +3 -3
package/dist/dockview.noStyle.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
|
*/
|
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
element.addEventListener(type, listener, options);
|
|
222
222
|
return {
|
|
223
223
|
dispose: () => {
|
|
224
|
-
element.removeEventListener(type, listener);
|
|
224
|
+
element.removeEventListener(type, listener, options);
|
|
225
225
|
},
|
|
226
226
|
};
|
|
227
227
|
}
|
|
@@ -229,7 +229,7 @@
|
|
|
229
229
|
element.addEventListener(type, listener, options);
|
|
230
230
|
return {
|
|
231
231
|
dispose: () => {
|
|
232
|
-
element.removeEventListener(type, listener);
|
|
232
|
+
element.removeEventListener(type, listener, options);
|
|
233
233
|
},
|
|
234
234
|
};
|
|
235
235
|
}
|
|
@@ -914,7 +914,7 @@
|
|
|
914
914
|
//add sash
|
|
915
915
|
const sash = document.createElement('div');
|
|
916
916
|
sash.className = 'sash';
|
|
917
|
-
const
|
|
917
|
+
const onPointerStart = (event) => {
|
|
918
918
|
for (const item of this.viewItems) {
|
|
919
919
|
item.enabled = false;
|
|
920
920
|
}
|
|
@@ -973,11 +973,10 @@
|
|
|
973
973
|
size: snappedViewItem.size,
|
|
974
974
|
};
|
|
975
975
|
}
|
|
976
|
-
|
|
977
|
-
const mousemove = (mousemoveEvent) => {
|
|
976
|
+
const onPointerMove = (event) => {
|
|
978
977
|
const current = this._orientation === exports.Orientation.HORIZONTAL
|
|
979
|
-
?
|
|
980
|
-
:
|
|
978
|
+
? event.clientX
|
|
979
|
+
: event.clientY;
|
|
981
980
|
const delta = current - start;
|
|
982
981
|
this.resize(sashIndex, delta, sizes, undefined, undefined, minDelta, maxDelta, snapBefore, snapAfter);
|
|
983
982
|
this.distributeEmptySpace();
|
|
@@ -991,20 +990,20 @@
|
|
|
991
990
|
iframe.style.pointerEvents = 'auto';
|
|
992
991
|
}
|
|
993
992
|
this.saveProportions();
|
|
994
|
-
document.removeEventListener('
|
|
995
|
-
document.removeEventListener('
|
|
996
|
-
document.removeEventListener('
|
|
993
|
+
document.removeEventListener('pointermove', onPointerMove);
|
|
994
|
+
document.removeEventListener('pointerup', end);
|
|
995
|
+
document.removeEventListener('pointercancel', end);
|
|
997
996
|
this._onDidSashEnd.fire(undefined);
|
|
998
997
|
};
|
|
999
|
-
document.addEventListener('
|
|
1000
|
-
document.addEventListener('
|
|
1001
|
-
document.addEventListener('
|
|
998
|
+
document.addEventListener('pointermove', onPointerMove);
|
|
999
|
+
document.addEventListener('pointerup', end);
|
|
1000
|
+
document.addEventListener('pointercancel', end);
|
|
1002
1001
|
};
|
|
1003
|
-
sash.addEventListener('
|
|
1002
|
+
sash.addEventListener('pointerdown', onPointerStart);
|
|
1004
1003
|
const sashItem = {
|
|
1005
1004
|
container: sash,
|
|
1006
1005
|
disposable: () => {
|
|
1007
|
-
sash.removeEventListener('
|
|
1006
|
+
sash.removeEventListener('pointerdown', onPointerStart);
|
|
1008
1007
|
this.sashContainer.removeChild(sash);
|
|
1009
1008
|
},
|
|
1010
1009
|
};
|
|
@@ -2097,58 +2096,70 @@
|
|
|
2097
2096
|
if (!(parent instanceof BranchNode)) {
|
|
2098
2097
|
throw new Error('Invalid location');
|
|
2099
2098
|
}
|
|
2100
|
-
const
|
|
2101
|
-
if (!(
|
|
2099
|
+
const nodeToRemove = parent.children[index];
|
|
2100
|
+
if (!(nodeToRemove instanceof LeafNode)) {
|
|
2102
2101
|
throw new Error('Invalid location');
|
|
2103
2102
|
}
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
if (parent.children.length === 0) {
|
|
2109
|
-
return view;
|
|
2110
|
-
}
|
|
2111
|
-
if (parent.children.length > 1) {
|
|
2112
|
-
return view;
|
|
2103
|
+
parent.removeChild(index, sizing);
|
|
2104
|
+
nodeToRemove.dispose();
|
|
2105
|
+
if (parent.children.length !== 1) {
|
|
2106
|
+
return nodeToRemove.view;
|
|
2113
2107
|
}
|
|
2108
|
+
// if the parent has only one child and we know the parent is a BranchNode we can make the tree
|
|
2109
|
+
// more efficiently spaced by replacing the parent BranchNode with the child.
|
|
2110
|
+
// if that child is a LeafNode then we simply replace the BranchNode with the child otherwise if the child
|
|
2111
|
+
// is a BranchNode too we should spread it's children into the grandparent.
|
|
2112
|
+
// refer to the remaining child as the sibling
|
|
2114
2113
|
const sibling = parent.children[0];
|
|
2115
2114
|
if (pathToParent.length === 0) {
|
|
2116
|
-
// parent is root
|
|
2115
|
+
// if the parent is root
|
|
2117
2116
|
if (sibling instanceof LeafNode) {
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2117
|
+
// if the sibling is a leaf node no action is required
|
|
2118
|
+
return nodeToRemove.view;
|
|
2119
|
+
}
|
|
2120
|
+
// otherwise the sibling is a branch node. since the parent is the root and the root has only one child
|
|
2121
|
+
// which is a branch node we can just set this branch node to be the new root node
|
|
2122
|
+
// for good housekeeping we'll removing the sibling from it's existing tree
|
|
2123
|
+
parent.removeChild(0, sizing);
|
|
2124
|
+
// and set that sibling node to be root
|
|
2123
2125
|
this.root = sibling;
|
|
2124
|
-
return view;
|
|
2126
|
+
return nodeToRemove.view;
|
|
2125
2127
|
}
|
|
2128
|
+
// otherwise the parent is apart of a large sub-tree
|
|
2126
2129
|
const [grandParent, ..._] = [...pathToParent].reverse();
|
|
2127
2130
|
const [parentIndex, ...__] = [...rest].reverse();
|
|
2128
2131
|
const isSiblingVisible = parent.isChildVisible(0);
|
|
2129
|
-
|
|
2130
|
-
|
|
2132
|
+
// either way we need to remove the sibling from it's existing tree
|
|
2133
|
+
parent.removeChild(0, sizing);
|
|
2134
|
+
// note the sizes of all of the grandparents children
|
|
2131
2135
|
const sizes = grandParent.children.map((_size, i) => grandParent.getChildSize(i));
|
|
2132
|
-
|
|
2133
|
-
|
|
2136
|
+
// remove the parent from the grandparent since we are moving the sibling to take the parents place
|
|
2137
|
+
// this parent is no longer used and can be disposed of
|
|
2138
|
+
grandParent.removeChild(parentIndex, sizing).dispose();
|
|
2134
2139
|
if (sibling instanceof BranchNode) {
|
|
2140
|
+
// replace the parent with the siblings children
|
|
2135
2141
|
sizes.splice(parentIndex, 1, ...sibling.children.map((c) => c.size));
|
|
2142
|
+
// and add those siblings to the grandparent
|
|
2136
2143
|
for (let i = 0; i < sibling.children.length; i++) {
|
|
2137
2144
|
const child = sibling.children[i];
|
|
2138
2145
|
grandParent.addChild(child, child.size, parentIndex + i);
|
|
2139
2146
|
}
|
|
2140
2147
|
}
|
|
2141
2148
|
else {
|
|
2149
|
+
// otherwise create a new leaf node and add that to the grandparent
|
|
2142
2150
|
const newSibling = new LeafNode(sibling.view, orthogonal(sibling.orientation), sibling.size);
|
|
2143
2151
|
const siblingSizing = isSiblingVisible
|
|
2144
2152
|
? sibling.orthogonalSize
|
|
2145
2153
|
: exports.Sizing.Invisible(sibling.orthogonalSize);
|
|
2146
2154
|
grandParent.addChild(newSibling, siblingSizing, parentIndex);
|
|
2147
2155
|
}
|
|
2156
|
+
// the containing node of the sibling is no longer required and can be disposed of
|
|
2157
|
+
sibling.dispose();
|
|
2158
|
+
// resize everything
|
|
2148
2159
|
for (let i = 0; i < sizes.length; i++) {
|
|
2149
2160
|
grandParent.resizeChild(i, sizes[i]);
|
|
2150
2161
|
}
|
|
2151
|
-
return view;
|
|
2162
|
+
return nodeToRemove.view;
|
|
2152
2163
|
}
|
|
2153
2164
|
layout(width, height) {
|
|
2154
2165
|
const [size, orthogonalSize] = this.root.orientation === exports.Orientation.HORIZONTAL
|
|
@@ -2861,25 +2872,32 @@
|
|
|
2861
2872
|
constructor(el) {
|
|
2862
2873
|
super();
|
|
2863
2874
|
this.el = el;
|
|
2864
|
-
this.
|
|
2875
|
+
this.dataDisposable = new MutableDisposable();
|
|
2876
|
+
this.pointerEventsDisposable = new MutableDisposable();
|
|
2865
2877
|
this._onDragStart = new Emitter();
|
|
2866
2878
|
this.onDragStart = this._onDragStart.event;
|
|
2867
|
-
this.
|
|
2868
|
-
this.addDisposables(this._onDragStart);
|
|
2879
|
+
this.addDisposables(this._onDragStart, this.dataDisposable, this.pointerEventsDisposable);
|
|
2869
2880
|
this.configure();
|
|
2870
2881
|
}
|
|
2871
2882
|
configure() {
|
|
2872
2883
|
this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
|
|
2873
|
-
|
|
2884
|
+
const iframes = [
|
|
2874
2885
|
...getElementsByTagName('iframe'),
|
|
2875
2886
|
...getElementsByTagName('webview'),
|
|
2876
2887
|
];
|
|
2877
|
-
|
|
2888
|
+
this.pointerEventsDisposable.value = {
|
|
2889
|
+
dispose: () => {
|
|
2890
|
+
for (const iframe of iframes) {
|
|
2891
|
+
iframe.style.pointerEvents = 'auto';
|
|
2892
|
+
}
|
|
2893
|
+
},
|
|
2894
|
+
};
|
|
2895
|
+
for (const iframe of iframes) {
|
|
2878
2896
|
iframe.style.pointerEvents = 'none';
|
|
2879
2897
|
}
|
|
2880
2898
|
this.el.classList.add('dv-dragged');
|
|
2881
2899
|
setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
|
|
2882
|
-
this.
|
|
2900
|
+
this.dataDisposable.value = this.getData(event.dataTransfer);
|
|
2883
2901
|
if (event.dataTransfer) {
|
|
2884
2902
|
event.dataTransfer.effectAllowed = 'move';
|
|
2885
2903
|
/**
|
|
@@ -2894,11 +2912,8 @@
|
|
|
2894
2912
|
event.dataTransfer.setData('text/plain', '__dockview_internal_drag_event__');
|
|
2895
2913
|
}
|
|
2896
2914
|
}), addDisposableListener(this.el, 'dragend', () => {
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
}
|
|
2900
|
-
this.iframes = [];
|
|
2901
|
-
this.disposable.dispose();
|
|
2915
|
+
this.pointerEventsDisposable.dispose();
|
|
2916
|
+
this.dataDisposable.dispose();
|
|
2902
2917
|
}));
|
|
2903
2918
|
}
|
|
2904
2919
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dockview",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.6",
|
|
4
4
|
"description": "Zero dependency layout manager supporting tabs, grids and splitviews with ReactJS support",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"types": "./dist/cjs/index.d.ts",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"author": "https://github.com/mathuo",
|
|
57
57
|
"license": "MIT",
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"dockview-core": "^1.7.
|
|
59
|
+
"dockview-core": "^1.7.6"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"rollup": "^3.15.0",
|
|
74
74
|
"rollup-plugin-postcss": "^4.0.2"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "5d1b6c336f066cfc43eb07ad6d27e1e30d1fe16f"
|
|
77
77
|
}
|