Merge branch 'master' of https://github.com/mathuo/dockview into 538-interested-in-porting-dockview-to-vuejs

This commit is contained in:
mathuo 2024-04-15 21:20:46 +01:00
commit 9642dd844d
No known key found for this signature in database
GPG Key ID: C6EEDEFD6CA07281
11 changed files with 43265 additions and 42944 deletions

View File

@ -2,7 +2,7 @@
"packages": [
"packages/*"
],
"version": "1.11.0",
"version": "1.12.0",
"npmClient": "yarn",
"command": {
"publish": {

View File

@ -1,6 +1,6 @@
{
"name": "dockview-core",
"version": "1.11.0",
"version": "1.12.0",
"description": "Zero dependency layout manager supporting tabs, grids and splitviews",
"keywords": [
"splitview",

View File

@ -31,6 +31,12 @@ export interface DockviewPanelApi
// omit properties that do not make sense here
'setVisible' | 'onDidConstraintsChange' | 'setConstraints'
> {
/**
* The id of the tab component renderer
*
* Undefined if no custom tab renderer is provided
*/
readonly tabComponent: string | undefined;
readonly group: DockviewGroupPanel;
readonly isGroupActive: boolean;
readonly renderer: DockviewPanelRenderer;

View File

@ -28,6 +28,10 @@ export interface PanelApi {
setActive(): void;
setVisible(isVisible: boolean): void;
updateParameters(parameters: Parameters): void;
/**
* The id of the component renderer
*/
readonly component: string;
/**
* The id of the panel that would have been assigned when the panel was created
*/

View File

@ -15,6 +15,7 @@ import {
DockviewGroupDropLocation,
WillShowOverlayLocationEvent,
} from '../../dockviewGroupPanelModel';
import { getPanelData } from '../../../dnd/dataTransfer';
export interface TabDropIndexEvent {
readonly event: DragEvent;
@ -247,6 +248,10 @@ export class TabsContainer
this._onWillShowOverlay.fire(
new WillShowOverlayLocationEvent(event, {
kind: 'header_space',
panel: this.group.activePanel,
api: this.accessor.api,
group: this.group,
getData: getPanelData,
})
);
}),
@ -408,7 +413,13 @@ export class TabsContainer
}),
tab.onWillShowOverlay((event) => {
this._onWillShowOverlay.fire(
new WillShowOverlayLocationEvent(event, { kind: 'tab' })
new WillShowOverlayLocationEvent(event, {
kind: 'tab',
panel: this.group.activePanel,
api: this.accessor.api,
group: this.group,
getData: getPanelData,
})
);
})
);

View File

@ -419,6 +419,10 @@ export class DockviewComponent
return this.options.defaultRenderer ?? 'onlyWhenVisible';
}
get api(): DockviewApi {
return this._api;
}
constructor(options: DockviewComponentOptions) {
super({
proportionalLayout: true,
@ -572,6 +576,10 @@ export class DockviewComponent
this._onWillShowOverlay.fire(
new WillShowOverlayLocationEvent(event, {
kind: 'edge',
panel: undefined,
api: this._api,
group: undefined,
getData: getPanelData,
})
);
}),

View File

@ -194,13 +194,9 @@ export type DockviewGroupLocation =
| { type: 'floating' }
| { type: 'popout'; getWindow: () => Window };
type A = typeof WillShowOverlayEvent;
export class WillShowOverlayLocationEvent implements IDockviewEvent {
private _kind: DockviewGroupDropLocation;
get kind(): DockviewGroupDropLocation {
return this._kind;
return this.options.kind;
}
get nativeEvent(): DragEvent {
@ -215,18 +211,36 @@ export class WillShowOverlayLocationEvent implements IDockviewEvent {
return this.event.defaultPrevented;
}
get panel(): IDockviewPanel | undefined {
return this.options.panel;
}
get api(): DockviewApi {
return this.options.api;
}
get group(): DockviewGroupPanel | undefined {
return this.options.group;
}
preventDefault(): void {
this.event.preventDefault();
}
getData(): PanelTransfer | undefined {
return this.options.getData();
}
constructor(
private readonly event: WillShowOverlayEvent,
options: {
private readonly options: {
kind: DockviewGroupDropLocation;
panel: IDockviewPanel | undefined;
api: DockviewApi;
group: DockviewGroupPanel | undefined;
getData: () => PanelTransfer | undefined;
}
) {
this._kind = options.kind;
}
) {}
}
export class DockviewGroupPanelModel
@ -473,6 +487,10 @@ export class DockviewGroupPanelModel
this._onWillShowOverlay.fire(
new WillShowOverlayLocationEvent(event, {
kind: 'content',
panel: this.activePanel,
api: this._api,
group: this.groupPanel,
getData: getPanelData,
})
);
}),

View File

@ -1,6 +1,6 @@
{
"name": "dockview",
"version": "1.11.0",
"version": "1.12.0",
"description": "Zero dependency layout manager supporting tabs, grids and splitviews",
"keywords": [
"splitview",
@ -54,6 +54,6 @@
"test:cov": "cross-env ../../node_modules/.bin/jest --selectProjects dockview --coverage"
},
"dependencies": {
"dockview-core": "^1.11.0"
"dockview-core": "^1.12.0"
}
}

View File

@ -0,0 +1,19 @@
---
slug: dockview-1.12.0-release
title: Dockview 1.12.0
tags: [release]
---
# Release Notes
Please reference docs @ [dockview.dev](https://dockview.dev).
## 🚀 Features
- Enhance `onWillShowOverlay` event to contain additional commonly used methods and properties [#564](https://github.com/mathuo/dockview/issues/564)
- Expose `api.component` and `api.tabComponent` on panel api [#569](https://github.com/mathuo/dockview/issues/569)
## 🔥 Breaking changes
- Fix Typo: `onlyWhenVisibile` to `onlyWhenVisible` [#559](https://github.com/mathuo/dockview/pull/559)

View File

@ -1,6 +1,6 @@
{
"name": "dockview-docs",
"version": "1.11.0",
"version": "1.12.0",
"private": true,
"scripts": {
"build": "npm run create-templates && docusaurus build",
@ -37,7 +37,7 @@
"ag-grid-react": "^31.0.2",
"axios": "^1.6.3",
"clsx": "^2.1.0",
"dockview": "^1.11.0",
"dockview": "^1.12.0",
"prism-react-renderer": "^2.3.1",
"react-dnd": "^16.0.1",
"react-laag": "^2.0.5",

View File

@ -2467,7 +2467,7 @@
"summary": [
{
"kind": "text",
"text": "Invoked before a group is dragged.\n\nCalling "
"text": "Invoked before a group is dragged.\r\n\r\nCalling "
},
{
"kind": "code",
@ -2498,7 +2498,7 @@
"summary": [
{
"kind": "text",
"text": "Invoked before a group is dragged.\n\nCalling "
"text": "Invoked before a group is dragged.\r\n\r\nCalling "
},
{
"kind": "code",
@ -2521,7 +2521,7 @@
"summary": [
{
"kind": "text",
"text": "Invoked before a panel is dragged.\n\nCalling "
"text": "Invoked before a panel is dragged.\r\n\r\nCalling "
},
{
"kind": "code",
@ -2552,7 +2552,7 @@
"summary": [
{
"kind": "text",
"text": "Invoked before a panel is dragged.\n\nCalling "
"text": "Invoked before a panel is dragged.\r\n\r\nCalling "
},
{
"kind": "code",
@ -2575,7 +2575,7 @@
"summary": [
{
"kind": "text",
"text": "Invoked when a Drag'n'Drop event occurs but before dockview handles it giving the user an opportunity to intecept and\nprevent the event from occuring using the standard "
"text": "Invoked when a Drag'n'Drop event occurs but before dockview handles it giving the user an opportunity to intecept and\r\nprevent the event from occuring using the standard "
},
{
"kind": "code",
@ -2583,7 +2583,7 @@
},
{
"kind": "text",
"text": " syntax.\n\nPreventing certain events may causes unexpected behaviours, use carefully."
"text": " syntax.\r\n\r\nPreventing certain events may causes unexpected behaviours, use carefully."
}
]
},
@ -2606,7 +2606,7 @@
"summary": [
{
"kind": "text",
"text": "Invoked when a Drag'n'Drop event occurs but before dockview handles it giving the user an opportunity to intecept and\nprevent the event from occuring using the standard "
"text": "Invoked when a Drag'n'Drop event occurs but before dockview handles it giving the user an opportunity to intecept and\r\nprevent the event from occuring using the standard "
},
{
"kind": "code",
@ -2614,7 +2614,7 @@
},
{
"kind": "text",
"text": " syntax.\n\nPreventing certain events may causes unexpected behaviours, use carefully."
"text": " syntax.\r\n\r\nPreventing certain events may causes unexpected behaviours, use carefully."
}
]
}
@ -2629,7 +2629,7 @@
"summary": [
{
"kind": "text",
"text": "Invoked before an overlay is shown indicating a drop target.\n\nCalling "
"text": "Invoked before an overlay is shown indicating a drop target.\r\n\r\nCalling "
},
{
"kind": "code",
@ -2637,7 +2637,7 @@
},
{
"kind": "text",
"text": " will prevent the overlay being shown and prevent\nthe any subsequent drop event."
"text": " will prevent the overlay being shown and prevent\r\nthe any subsequent drop event."
}
]
},
@ -2660,7 +2660,7 @@
"summary": [
{
"kind": "text",
"text": "Invoked before an overlay is shown indicating a drop target.\n\nCalling "
"text": "Invoked before an overlay is shown indicating a drop target.\r\n\r\nCalling "
},
{
"kind": "code",
@ -2668,7 +2668,7 @@
},
{
"kind": "text",
"text": " will prevent the overlay being shown and prevent\nthe any subsequent drop event."
"text": " will prevent the overlay being shown and prevent\r\nthe any subsequent drop event."
}
]
}
@ -4441,6 +4441,21 @@
}
}
},
{
"name": "api",
"code": "DockviewApi",
"kind": "accessor",
"value": {
"name": "api",
"code": "DockviewApi",
"kind": "getSignature",
"returnType": {
"type": "reference",
"value": "DockviewApi",
"source": "dockview-core"
}
}
},
{
"name": "disableResizing",
"code": "boolean",
@ -10648,7 +10663,7 @@
"summary": [
{
"kind": "text",
"text": "If the root is orientated as a VERTICAL node then nest the existing root within a new HORIZIONTAL root node\nIf the root is orientated as a HORIZONTAL node then nest the existing root within a new VERITCAL root node"
"text": "If the root is orientated as a VERTICAL node then nest the existing root within a new HORIZIONTAL root node\r\nIf the root is orientated as a HORIZONTAL node then nest the existing root within a new VERITCAL root node"
}
]
},
@ -10666,7 +10681,7 @@
"summary": [
{
"kind": "text",
"text": "If the root is orientated as a VERTICAL node then nest the existing root within a new HORIZIONTAL root node\nIf the root is orientated as a HORIZONTAL node then nest the existing root within a new VERITCAL root node"
"text": "If the root is orientated as a VERTICAL node then nest the existing root within a new HORIZIONTAL root node\r\nIf the root is orientated as a HORIZONTAL node then nest the existing root within a new VERITCAL root node"
}
]
}
@ -18987,7 +19002,7 @@
"summary": [
{
"kind": "text",
"text": "Invoked whenever any aspect of the layout changes.\nIf listening to this event it may be worth debouncing ouputs."
"text": "Invoked whenever any aspect of the layout changes.\r\nIf listening to this event it may be worth debouncing ouputs."
}
]
},
@ -19009,7 +19024,7 @@
"summary": [
{
"kind": "text",
"text": "Invoked whenever any aspect of the layout changes.\nIf listening to this event it may be worth debouncing ouputs."
"text": "Invoked whenever any aspect of the layout changes.\r\nIf listening to this event it may be worth debouncing ouputs."
}
]
}
@ -19571,7 +19586,7 @@
},
{
"kind": "text",
"text": " method\nfor the subsequent resize."
"text": " method\r\nfor the subsequent resize."
}
]
},
@ -19633,7 +19648,7 @@
},
{
"kind": "text",
"text": " method\nfor the subsequent resize."
"text": " method\r\nfor the subsequent resize."
}
]
}
@ -21339,6 +21354,21 @@
"kind": "constructor",
"code": ""
},
{
"name": "api",
"code": "DockviewApi",
"kind": "accessor",
"value": {
"name": "api",
"code": "DockviewApi",
"kind": "getSignature",
"returnType": {
"type": "reference",
"value": "DockviewApi",
"source": "dockview-core"
}
}
},
{
"name": "defaultPrevented",
"code": "boolean",
@ -21353,6 +21383,30 @@
}
}
},
{
"name": "group",
"code": "DockviewGroupPanel | undefined",
"kind": "accessor",
"value": {
"name": "group",
"code": "DockviewGroupPanel | undefined",
"kind": "getSignature",
"returnType": {
"type": "or",
"values": [
{
"type": "reference",
"value": "DockviewGroupPanel",
"source": "dockview-core"
},
{
"type": "intrinsic",
"value": "undefined"
}
]
}
}
},
{
"name": "kind",
"code": "DockviewGroupDropLocation",
@ -21383,6 +21437,30 @@
}
}
},
{
"name": "panel",
"code": "IDockviewPanel | undefined",
"kind": "accessor",
"value": {
"name": "panel",
"code": "IDockviewPanel | undefined",
"kind": "getSignature",
"returnType": {
"type": "or",
"values": [
{
"type": "reference",
"value": "IDockviewPanel",
"source": "dockview-core"
},
{
"type": "intrinsic",
"value": "undefined"
}
]
}
}
},
{
"name": "position",
"code": "Position",
@ -21398,6 +21476,34 @@
}
}
},
{
"name": "getData",
"code": "(): PanelTransfer | undefined",
"kind": "method",
"signature": [
{
"name": "getData",
"typeParameters": [],
"parameters": [],
"returnType": {
"type": "or",
"values": [
{
"type": "reference",
"value": "PanelTransfer",
"source": "dockview-core"
},
{
"type": "intrinsic",
"value": "undefined"
}
]
},
"code": "(): PanelTransfer | undefined",
"kind": "callSignature"
}
]
},
{
"name": "preventDefault",
"code": "(): void",
@ -22867,6 +22973,26 @@
"kind": "interface",
"name": "DockviewGroupPanelApi",
"children": [
{
"name": "component",
"code": "string",
"kind": "property",
"type": {
"type": "intrinsic",
"value": "string"
},
"flags": {
"isReadonly": true
},
"comment": {
"summary": [
{
"kind": "text",
"text": "The id of the component renderer"
}
]
}
},
{
"name": "height",
"code": "number",
@ -23535,6 +23661,26 @@
"kind": "interface",
"name": "DockviewPanelApi",
"children": [
{
"name": "component",
"code": "string",
"kind": "property",
"type": {
"type": "intrinsic",
"value": "string"
},
"flags": {
"isReadonly": true
},
"comment": {
"summary": [
{
"kind": "text",
"text": "The id of the component renderer"
}
]
}
},
{
"name": "group",
"code": "DockviewGroupPanel",
@ -23906,6 +24052,35 @@
"isReadonly": true
}
},
{
"name": "tabComponent",
"code": "string | undefined",
"kind": "property",
"type": {
"type": "or",
"values": [
{
"type": "intrinsic",
"value": "string"
},
{
"type": "intrinsic",
"value": "undefined"
}
]
},
"flags": {
"isReadonly": true
},
"comment": {
"summary": [
{
"kind": "text",
"text": "The id of the tab component renderer\r\n\r\nUndefined if no custom tab renderer is provided"
}
]
}
},
{
"name": "title",
"code": "string | undefined",
@ -25076,6 +25251,26 @@
"kind": "interface",
"name": "GridviewPanelApi",
"children": [
{
"name": "component",
"code": "string",
"kind": "property",
"type": {
"type": "intrinsic",
"value": "string"
},
"flags": {
"isReadonly": true
},
"comment": {
"summary": [
{
"kind": "text",
"text": "The id of the component renderer"
}
]
}
},
{
"name": "height",
"code": "number",
@ -36205,6 +36400,26 @@
"kind": "interface",
"name": "PanelApi",
"children": [
{
"name": "component",
"code": "string",
"kind": "property",
"type": {
"type": "intrinsic",
"value": "string"
},
"flags": {
"isReadonly": true
},
"comment": {
"summary": [
{
"kind": "text",
"text": "The id of the component renderer"
}
]
}
},
{
"name": "height",
"code": "number",
@ -37279,6 +37494,26 @@
"kind": "interface",
"name": "PaneviewPanelApi",
"children": [
{
"name": "component",
"code": "string",
"kind": "property",
"type": {
"type": "intrinsic",
"value": "string"
},
"flags": {
"isReadonly": true
},
"comment": {
"summary": [
{
"kind": "text",
"text": "The id of the component renderer"
}
]
}
},
{
"name": "height",
"code": "number",
@ -38837,6 +39072,26 @@
"kind": "interface",
"name": "SplitviewPanelApi",
"children": [
{
"name": "component",
"code": "string",
"kind": "property",
"type": {
"type": "intrinsic",
"value": "string"
},
"flags": {
"isReadonly": true
},
"comment": {
"summary": [
{
"kind": "text",
"text": "The id of the component renderer"
}
]
}
},
{
"name": "height",
"code": "number",
@ -40453,7 +40708,7 @@
"summary": [
{
"kind": "text",
"text": "Find the grid location of a specific DOM element by traversing the parent\nchain and finding each child index on the way.\n\nThis will break as soon as DOM structures of the Splitview or Gridview change."
"text": "Find the grid location of a specific DOM element by traversing the parent\r\nchain and finding each child index on the way.\r\n\r\nThis will break as soon as DOM structures of the Splitview or Gridview change."
}
]
},
@ -43086,7 +43341,7 @@
"summary": [
{
"kind": "text",
"text": "A React Hook that returns an array of portals to be rendered by the user of this hook\nand a disposable function to add a portal. Calling dispose removes this portal from the\nportal array"
"text": "A React Hook that returns an array of portals to be rendered by the user of this hook\r\nand a disposable function to add a portal. Calling dispose removes this portal from the\r\nportal array"
}
]
},