dockview-core 4.13.1 → 5.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/README.md +56 -8
- package/dist/cjs/api/dockviewGroupPanelApi.d.ts +5 -0
- package/dist/cjs/api/dockviewGroupPanelApi.js +13 -1
- package/dist/cjs/api/dockviewPanelApi.js +1 -1
- package/dist/cjs/constants.js +6 -1
- package/dist/cjs/dnd/abstractDragHandler.js +3 -1
- package/dist/cjs/dnd/droptarget.js +2 -2
- package/dist/cjs/dockview/components/popupService.js +2 -0
- package/dist/cjs/dockview/components/titlebar/tabs.d.ts +5 -0
- package/dist/cjs/dockview/components/titlebar/tabs.js +31 -4
- package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +5 -0
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +21 -0
- package/dist/cjs/dockview/deserializer.js +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts +2 -1
- package/dist/cjs/dockview/dockviewComponent.js +73 -47
- package/dist/cjs/dockview/dockviewGroupPanel.js +16 -13
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +11 -1
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +62 -5
- package/dist/cjs/dockview/framework.d.ts +2 -0
- package/dist/cjs/dockview/options.d.ts +3 -0
- package/dist/cjs/dockview/options.js +1 -0
- package/dist/cjs/dom.js +9 -1
- package/dist/cjs/framwork.d.ts +1 -1
- package/dist/cjs/lifecycle.d.ts +2 -1
- package/dist/cjs/lifecycle.js +6 -3
- package/dist/cjs/overlay/overlay.js +2 -1
- package/dist/cjs/overlay/overlayRenderContainer.js +8 -0
- package/dist/cjs/scrollbar.d.ts +5 -2
- package/dist/cjs/scrollbar.js +88 -26
- package/dist/dockview-core.js +273 -66
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.js.map +1 -1
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.min.noStyle.js.map +1 -1
- package/dist/dockview-core.noStyle.js +272 -65
- package/dist/esm/api/dockviewGroupPanelApi.d.ts +5 -0
- package/dist/esm/api/dockviewGroupPanelApi.js +14 -2
- package/dist/esm/api/dockviewPanelApi.js +1 -1
- package/dist/esm/constants.js +6 -1
- package/dist/esm/dnd/abstractDragHandler.js +3 -1
- package/dist/esm/dnd/droptarget.js +2 -2
- package/dist/esm/dockview/components/popupService.js +2 -0
- package/dist/esm/dockview/components/titlebar/tabs.d.ts +5 -0
- package/dist/esm/dockview/components/titlebar/tabs.js +28 -5
- package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +5 -0
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +18 -1
- package/dist/esm/dockview/deserializer.js +1 -1
- package/dist/esm/dockview/dockviewComponent.d.ts +2 -1
- package/dist/esm/dockview/dockviewComponent.js +15 -3
- package/dist/esm/dockview/dockviewGroupPanel.js +17 -14
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +11 -1
- package/dist/esm/dockview/dockviewGroupPanelModel.js +61 -8
- package/dist/esm/dockview/framework.d.ts +2 -0
- package/dist/esm/dockview/options.d.ts +3 -0
- package/dist/esm/dockview/options.js +1 -0
- package/dist/esm/dom.js +9 -1
- package/dist/esm/framwork.d.ts +1 -1
- package/dist/esm/lifecycle.d.ts +2 -1
- package/dist/esm/lifecycle.js +6 -3
- package/dist/esm/overlay/overlay.js +2 -1
- package/dist/esm/overlay/overlayRenderContainer.js +8 -0
- package/dist/esm/scrollbar.d.ts +5 -2
- package/dist/esm/scrollbar.js +85 -27
- package/dist/{dockview-core.cjs.js → package/main.cjs.js} +273 -66
- package/dist/package/main.cjs.min.js +7 -0
- package/dist/package/main.esm.min.mjs +7 -0
- package/dist/{dockview-core.esm.js → package/main.esm.mjs} +273 -66
- package/dist/styles/dockview.css +63 -7
- package/package.json +63 -53
- package/dist/dockview-core.amd.js +0 -11373
- package/dist/dockview-core.amd.js.map +0 -1
- package/dist/dockview-core.amd.min.js +0 -8
- package/dist/dockview-core.amd.min.js.map +0 -1
- package/dist/dockview-core.amd.min.noStyle.js +0 -8
- package/dist/dockview-core.amd.min.noStyle.js.map +0 -1
- package/dist/dockview-core.amd.noStyle.js +0 -11343
- package/dist/dockview-core.amd.noStyle.js.map +0 -1
- package/dist/dockview-core.cjs.js.map +0 -1
- package/dist/dockview-core.esm.js.map +0 -1
- package/dist/dockview-core.esm.min.js +0 -8
- package/dist/dockview-core.esm.min.js.map +0 -1
- package/dist/dockview-core.js.map +0 -1
- package/dist/dockview-core.noStyle.js.map +0 -1
|
@@ -29,6 +29,8 @@ export interface ViewFactoryData {
|
|
|
29
29
|
content: string;
|
|
30
30
|
tab?: string;
|
|
31
31
|
}
|
|
32
|
+
export type DockviewHeaderPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
33
|
+
export type DockviewHeaderDirection = 'horizontal' | 'vertical';
|
|
32
34
|
export interface DockviewOptions {
|
|
33
35
|
/**
|
|
34
36
|
* Disable the auto-resizing which is controlled through a `ResizeObserver`.
|
|
@@ -44,6 +46,7 @@ export interface DockviewOptions {
|
|
|
44
46
|
};
|
|
45
47
|
popoutUrl?: string;
|
|
46
48
|
defaultRenderer?: DockviewPanelRenderer;
|
|
49
|
+
defaultHeaderPosition?: DockviewHeaderPosition;
|
|
47
50
|
debug?: boolean;
|
|
48
51
|
dndEdges?: false | DroptargetOverlayModel;
|
|
49
52
|
/**
|
package/dist/esm/dom.js
CHANGED
|
@@ -267,9 +267,9 @@ export class Classnames {
|
|
|
267
267
|
}
|
|
268
268
|
const DEBOUCE_DELAY = 100;
|
|
269
269
|
export function isChildEntirelyVisibleWithinParent(child, parent) {
|
|
270
|
-
//
|
|
271
270
|
const childPosition = getDomNodePagePosition(child);
|
|
272
271
|
const parentPosition = getDomNodePagePosition(parent);
|
|
272
|
+
// Check horizontal visibility
|
|
273
273
|
if (childPosition.left < parentPosition.left) {
|
|
274
274
|
return false;
|
|
275
275
|
}
|
|
@@ -277,6 +277,14 @@ export function isChildEntirelyVisibleWithinParent(child, parent) {
|
|
|
277
277
|
parentPosition.left + parentPosition.width) {
|
|
278
278
|
return false;
|
|
279
279
|
}
|
|
280
|
+
// Check vertical visibility
|
|
281
|
+
if (childPosition.top < parentPosition.top) {
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
if (childPosition.top + childPosition.height >
|
|
285
|
+
parentPosition.top + parentPosition.height) {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
280
288
|
return true;
|
|
281
289
|
}
|
|
282
290
|
export function onDidWindowMoveEnd(window) {
|
package/dist/esm/framwork.d.ts
CHANGED
package/dist/esm/lifecycle.d.ts
CHANGED
|
@@ -10,11 +10,12 @@ export declare namespace Disposable {
|
|
|
10
10
|
function from(func: () => void): IDisposable;
|
|
11
11
|
}
|
|
12
12
|
export declare class CompositeDisposable {
|
|
13
|
-
private _disposables;
|
|
13
|
+
private readonly _disposables;
|
|
14
14
|
private _isDisposed;
|
|
15
15
|
get isDisposed(): boolean;
|
|
16
16
|
constructor(...args: IDisposable[]);
|
|
17
17
|
addDisposables(...args: IDisposable[]): void;
|
|
18
|
+
removeDisposable(disposable: IDisposable): void;
|
|
18
19
|
dispose(): void;
|
|
19
20
|
}
|
|
20
21
|
export declare class MutableDisposable implements IDisposable {
|
package/dist/esm/lifecycle.js
CHANGED
|
@@ -20,10 +20,13 @@ export class CompositeDisposable {
|
|
|
20
20
|
}
|
|
21
21
|
constructor(...args) {
|
|
22
22
|
this._isDisposed = false;
|
|
23
|
-
this._disposables = args;
|
|
23
|
+
this._disposables = new Set(args);
|
|
24
24
|
}
|
|
25
25
|
addDisposables(...args) {
|
|
26
|
-
args.forEach((arg) => this._disposables.
|
|
26
|
+
args.forEach((arg) => this._disposables.add(arg));
|
|
27
|
+
}
|
|
28
|
+
removeDisposable(disposable) {
|
|
29
|
+
this._disposables.delete(disposable);
|
|
27
30
|
}
|
|
28
31
|
dispose() {
|
|
29
32
|
if (this._isDisposed) {
|
|
@@ -31,7 +34,7 @@ export class CompositeDisposable {
|
|
|
31
34
|
}
|
|
32
35
|
this._isDisposed = true;
|
|
33
36
|
this._disposables.forEach((arg) => arg.dispose());
|
|
34
|
-
this._disposables
|
|
37
|
+
this._disposables.clear();
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
export class MutableDisposable {
|
|
@@ -20,7 +20,8 @@ class AriaLevelTracker {
|
|
|
20
20
|
update() {
|
|
21
21
|
for (let i = 0; i < this._orderedList.length; i++) {
|
|
22
22
|
this._orderedList[i].setAttribute('aria-level', `${i}`);
|
|
23
|
-
this._orderedList[i].style.zIndex =
|
|
23
|
+
this._orderedList[i].style.zIndex =
|
|
24
|
+
`calc(var(--dv-overlay-z-index, 999) + ${i * 2})`;
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
}
|
|
@@ -79,6 +79,9 @@ export class OverlayRenderContainer extends CompositeDisposable {
|
|
|
79
79
|
if (!this.map[panel.api.id]) {
|
|
80
80
|
const element = createFocusableElement();
|
|
81
81
|
element.className = 'dv-render-overlay';
|
|
82
|
+
// Hide until the first RAF-based position is applied to prevent a
|
|
83
|
+
// one-frame flash at position 0,0 when the element is first attached.
|
|
84
|
+
element.style.visibility = 'hidden';
|
|
82
85
|
this.map[panel.api.id] = {
|
|
83
86
|
panel,
|
|
84
87
|
disposable: Disposable.NONE,
|
|
@@ -115,6 +118,11 @@ export class OverlayRenderContainer extends CompositeDisposable {
|
|
|
115
118
|
focusContainer.style.top = `${top}px`;
|
|
116
119
|
focusContainer.style.width = `${width}px`;
|
|
117
120
|
focusContainer.style.height = `${height}px`;
|
|
121
|
+
// Reveal after the first position is applied (was hidden to
|
|
122
|
+
// prevent a flash at 0,0 before the initial layout fires).
|
|
123
|
+
if (focusContainer.style.visibility === 'hidden') {
|
|
124
|
+
focusContainer.style.visibility = '';
|
|
125
|
+
}
|
|
118
126
|
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location.type === 'floating');
|
|
119
127
|
});
|
|
120
128
|
};
|
package/dist/esm/scrollbar.d.ts
CHANGED
|
@@ -2,11 +2,14 @@ import { CompositeDisposable } from './lifecycle';
|
|
|
2
2
|
export declare class Scrollbar extends CompositeDisposable {
|
|
3
3
|
private readonly scrollableElement;
|
|
4
4
|
private readonly _element;
|
|
5
|
-
private readonly
|
|
6
|
-
private
|
|
5
|
+
private readonly _scrollbar;
|
|
6
|
+
private _scrollOffset;
|
|
7
7
|
private _animationTimer;
|
|
8
|
+
private _orientation;
|
|
8
9
|
static MouseWheelSpeed: number;
|
|
9
10
|
get element(): HTMLElement;
|
|
11
|
+
get orientation(): 'horizontal' | 'vertical';
|
|
12
|
+
set orientation(value: 'horizontal' | 'vertical');
|
|
10
13
|
constructor(scrollableElement: HTMLElement);
|
|
11
14
|
private calculateScrollbarStyles;
|
|
12
15
|
}
|
package/dist/esm/scrollbar.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toggleClass, watchElementResize } from './dom';
|
|
1
|
+
import { addClasses, removeClasses, toggleClass, watchElementResize, } from './dom';
|
|
2
2
|
import { addDisposableListener } from './events';
|
|
3
3
|
import { CompositeDisposable } from './lifecycle';
|
|
4
4
|
import { clamp } from './math';
|
|
@@ -6,30 +6,56 @@ export class Scrollbar extends CompositeDisposable {
|
|
|
6
6
|
get element() {
|
|
7
7
|
return this._element;
|
|
8
8
|
}
|
|
9
|
+
get orientation() {
|
|
10
|
+
return this._orientation;
|
|
11
|
+
}
|
|
12
|
+
set orientation(value) {
|
|
13
|
+
if (this._orientation === value) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
this._scrollOffset = 0;
|
|
17
|
+
this._orientation = value;
|
|
18
|
+
removeClasses(this._scrollbar, 'dv-scrollbar-vertical', 'dv-scrollbar-horizontal');
|
|
19
|
+
if (value === 'vertical') {
|
|
20
|
+
addClasses(this._scrollbar, 'dv-scrollbar-vertical');
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
addClasses(this._scrollbar, 'dv-scrollbar-horizontal');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
9
26
|
constructor(scrollableElement) {
|
|
10
27
|
super();
|
|
11
28
|
this.scrollableElement = scrollableElement;
|
|
12
|
-
this.
|
|
29
|
+
this._scrollOffset = 0;
|
|
30
|
+
this._orientation = 'horizontal';
|
|
13
31
|
this._element = document.createElement('div');
|
|
14
32
|
this._element.className = 'dv-scrollable';
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
33
|
+
this._scrollbar = document.createElement('div');
|
|
34
|
+
this._scrollbar.className = 'dv-scrollbar dv-scrollbar-horizontal';
|
|
17
35
|
this.element.appendChild(scrollableElement);
|
|
18
|
-
this.element.appendChild(this.
|
|
36
|
+
this.element.appendChild(this._scrollbar);
|
|
19
37
|
this.addDisposables(addDisposableListener(this.element, 'wheel', (event) => {
|
|
20
|
-
this.
|
|
38
|
+
this._scrollOffset += event.deltaY * Scrollbar.MouseWheelSpeed;
|
|
21
39
|
this.calculateScrollbarStyles();
|
|
22
|
-
}), addDisposableListener(this.
|
|
40
|
+
}), addDisposableListener(this._scrollbar, 'pointerdown', (event) => {
|
|
23
41
|
event.preventDefault();
|
|
24
42
|
toggleClass(this.element, 'dv-scrollable-scrolling', true);
|
|
25
|
-
const
|
|
26
|
-
|
|
43
|
+
const originalClient = this._orientation === 'horizontal'
|
|
44
|
+
? event.clientX
|
|
45
|
+
: event.clientY;
|
|
46
|
+
const originalScrollOffset = this._scrollOffset;
|
|
27
47
|
const onPointerMove = (event) => {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
48
|
+
const delta = this._orientation === 'horizontal'
|
|
49
|
+
? event.clientX - originalClient
|
|
50
|
+
: event.clientY - originalClient;
|
|
51
|
+
const clientSize = this._orientation === 'horizontal'
|
|
52
|
+
? this.element.clientWidth
|
|
53
|
+
: this.element.clientHeight;
|
|
54
|
+
const scrollSize = this._orientation === 'horizontal'
|
|
55
|
+
? this.scrollableElement.scrollWidth
|
|
56
|
+
: this.scrollableElement.scrollHeight;
|
|
57
|
+
const p = clientSize / scrollSize;
|
|
58
|
+
this._scrollOffset = originalScrollOffset + delta / p;
|
|
33
59
|
this.calculateScrollbarStyles();
|
|
34
60
|
};
|
|
35
61
|
const onEnd = () => {
|
|
@@ -44,7 +70,10 @@ export class Scrollbar extends CompositeDisposable {
|
|
|
44
70
|
}), addDisposableListener(this.element, 'scroll', () => {
|
|
45
71
|
this.calculateScrollbarStyles();
|
|
46
72
|
}), addDisposableListener(this.scrollableElement, 'scroll', () => {
|
|
47
|
-
this.
|
|
73
|
+
this._scrollOffset =
|
|
74
|
+
this._orientation === 'horizontal'
|
|
75
|
+
? this.scrollableElement.scrollLeft
|
|
76
|
+
: this.scrollableElement.scrollTop;
|
|
48
77
|
this.calculateScrollbarStyles();
|
|
49
78
|
}), watchElementResize(this.element, () => {
|
|
50
79
|
toggleClass(this.element, 'dv-scrollable-resizing', true);
|
|
@@ -59,21 +88,50 @@ export class Scrollbar extends CompositeDisposable {
|
|
|
59
88
|
}));
|
|
60
89
|
}
|
|
61
90
|
calculateScrollbarStyles() {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
91
|
+
const clientSize = this._orientation === 'horizontal'
|
|
92
|
+
? this.element.clientWidth
|
|
93
|
+
: this.element.clientHeight;
|
|
94
|
+
const scrollSize = this._orientation === 'horizontal'
|
|
95
|
+
? this.scrollableElement.scrollWidth
|
|
96
|
+
: this.scrollableElement.scrollHeight;
|
|
97
|
+
const hasScrollbar = scrollSize > clientSize;
|
|
65
98
|
if (hasScrollbar) {
|
|
66
|
-
const px =
|
|
67
|
-
this.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
99
|
+
const px = clientSize * (clientSize / scrollSize);
|
|
100
|
+
if (this._orientation === 'horizontal') {
|
|
101
|
+
this._scrollbar.style.width = `${px}px`;
|
|
102
|
+
this._scrollbar.style.height = '';
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
this._scrollbar.style.height = `${px}px`;
|
|
106
|
+
this._scrollbar.style.width = '';
|
|
107
|
+
}
|
|
108
|
+
this._scrollOffset = clamp(this._scrollOffset, 0, scrollSize - clientSize);
|
|
109
|
+
if (this._orientation === 'horizontal') {
|
|
110
|
+
this.scrollableElement.scrollLeft = this._scrollOffset;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
this.scrollableElement.scrollTop = this._scrollOffset;
|
|
114
|
+
}
|
|
115
|
+
const percentageComplete = this._scrollOffset / (scrollSize - clientSize);
|
|
116
|
+
if (this._orientation === 'horizontal') {
|
|
117
|
+
this._scrollbar.style.left = `${(clientSize - px) * percentageComplete}px`;
|
|
118
|
+
this._scrollbar.style.top = '';
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
this._scrollbar.style.top = `${(clientSize - px) * percentageComplete}px`;
|
|
122
|
+
this._scrollbar.style.left = '';
|
|
123
|
+
}
|
|
72
124
|
}
|
|
73
125
|
else {
|
|
74
|
-
this.
|
|
75
|
-
|
|
76
|
-
|
|
126
|
+
if (this._orientation === 'horizontal') {
|
|
127
|
+
this._scrollbar.style.width = '0px';
|
|
128
|
+
this._scrollbar.style.left = '0px';
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
this._scrollbar.style.height = '0px';
|
|
132
|
+
this._scrollbar.style.top = '0px';
|
|
133
|
+
}
|
|
134
|
+
this._scrollOffset = 0;
|
|
77
135
|
}
|
|
78
136
|
}
|
|
79
137
|
}
|