Skip to content

Commit ffddc95

Browse files
authored
chore: update docs (#429)
* chore: 1.9.0 docs
1 parent 5ca1cc5 commit ffddc95

File tree

40 files changed

+1781
-1394
lines changed

40 files changed

+1781
-1394
lines changed

.codesandbox/ci.json

+2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
"/packages/docs/sandboxes/keyboard-dockview",
2121
"/packages/docs/sandboxes/layout-dockview",
2222
"/packages/docs/sandboxes/lockedgroup-dockview",
23+
"/packages/docs/sandboxes/maximizegroup-dockview",
2324
"/packages/docs/sandboxes/nativeapp-dockview",
2425
"/packages/docs/sandboxes/nested-dockview",
26+
"/packages/docs/sandboxes/popoutgroup-dockview",
2527
"/packages/docs/sandboxes/rendering-dockview",
2628
"/packages/docs/sandboxes/rendermode-dockview",
2729
"/packages/docs/sandboxes/resize-dockview",

README.md

+16-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<div align="center">
22
<h1>dockview</h1>
33

4-
<p>Zero dependency layout manager supporting tabs, grids and splitviews with ReactJS support written in TypeScript</p>
4+
<p>Zero dependency layout manager supporting tabs, groups, grids and splitviews with ReactJS support written in TypeScript</p>
55

66
</div>
77

88
---
99

1010
[![npm version](https://badge.fury.io/js/dockview.svg)](https://www.npmjs.com/package/dockview)
11+
[![npm](https://img.shields.io/npm/dm/dockview)](https://www.npmjs.com/package/dockview)
1112
[![CI Build](https://github.com/mathuo/dockview/workflows/CI/badge.svg)](https://github.com/mathuo/dockview/actions?query=workflow%3ACI)
1213
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=mathuo_dockview&metric=coverage)](https://sonarcloud.io/summary/overall?id=mathuo_dockview)
1314
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mathuo_dockview&metric=alert_status)](https://sonarcloud.io/summary/overall?id=mathuo_dockview)
@@ -21,16 +22,20 @@ Please see the website: https://dockview.dev
2122

2223
## Features
2324

24-
- Simple splitviews, nested splitviews (i.e. gridviews) supporting full layout managment with
25-
dockable and tabular views
26-
- Extensive API support at the component level and view level
27-
- Themable and customizable
28-
- Serialization / deserialization support
29-
- Tabular docking and Drag and Drop support
30-
- Floating groups, customized header bars and tab
31-
- Documentation and examples
32-
33-
Want to inspect the latest deployment? Go to https://unpkg.com/browse/dockview@latest/
25+
- Serialization / deserialization with full layout management
26+
- Support for split-views, grid-views and 'dockable' views
27+
- Themeable and customizable
28+
- Tab and Group docking / Drag n' Drop
29+
- Popout Windows
30+
- Floating Groups
31+
- Extensive API
32+
- Supports Shadow DOMs
33+
- High test coverage
34+
- Documentation website with live examples
35+
- Transparent builds and Code Analysis
36+
- Security at mind - verifed publishing and builds through GitHub Actions
37+
38+
Want to verify our builds? Go [here](https://www.npmjs.com/package/dockview#Provenance).
3439

3540
## Quick start
3641

packages/dockview-core/README.md

+18-11
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,38 @@
88
---
99

1010
[![npm version](https://badge.fury.io/js/dockview.svg)](https://www.npmjs.com/package/dockview)
11+
[![npm](https://img.shields.io/npm/dm/dockview)](https://www.npmjs.com/package/dockview)
1112
[![CI Build](https://github.com/mathuo/dockview/workflows/CI/badge.svg)](https://github.com/mathuo/dockview/actions?query=workflow%3ACI)
1213
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=mathuo_dockview&metric=coverage)](https://sonarcloud.io/summary/overall?id=mathuo_dockview)
1314
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mathuo_dockview&metric=alert_status)](https://sonarcloud.io/summary/overall?id=mathuo_dockview)
1415
[![Bundle Phobia](https://badgen.net/bundlephobia/minzip/dockview)](https://bundlephobia.com/result?p=dockview)
1516

1617
##
1718

19+
![](packages/docs/static/img/splashscreen.gif)
20+
1821
Please see the website: https://dockview.dev
1922

2023
## Features
2124

22-
- Simple splitviews, nested splitviews (i.e. gridviews) supporting full layout managment with
23-
dockable and tabular views
24-
- Extensive API support at the component level and view level
25-
- Themable and customizable
26-
- Serialization / deserialization support
27-
- Tabular docking and Drag and Drop support
28-
- Floating groups, customized header bars and tab
29-
- Documentation and examples
30-
31-
Want to inspect the latest deployment? Go to https://unpkg.com/browse/dockview-core@latest/
25+
- Serialization / deserialization with full layout management
26+
- Support for split-views, grid-views and 'dockable' views
27+
- Themeable and customizable
28+
- Tab and Group docking / Drag n' Drop
29+
- Popout Windows
30+
- Floating Groups
31+
- Extensive API
32+
- Supports Shadow DOMs
33+
- High test coverage
34+
- Documentation website with live examples
35+
- Transparent builds and Code Analysis
36+
- Security at mind - verifed publishing and builds through GitHub Actions
37+
38+
Want to verify our builds? Go [here](https://www.npmjs.com/package/dockview#Provenance).
3239

3340
## Quick start
3441

35-
You can install dockview-core from [npm](https://www.npmjs.com/package/dockview-core).
42+
Dockview has a peer dependency on `react >= 16.8.0` and `react-dom >= 16.8.0`. You can install dockview from [npm](https://www.npmjs.com/package/dockview-core).
3643

3744
```
3845
npm install --save dockview-core

packages/dockview-core/src/dom.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ export function getDomNodePagePosition(domNode: Element): {
240240
export function isInDocument(element: Element): boolean {
241241
let currentElement: Element | ParentNode = element;
242242

243-
while (currentElement && currentElement.parentNode) {
243+
while (currentElement?.parentNode) {
244244
if (currentElement.parentNode === document) {
245245
return true;
246246
} else if (currentElement.parentNode instanceof DocumentFragment) {

packages/dockview/README.md

+15-10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
---
99

1010
[![npm version](https://badge.fury.io/js/dockview.svg)](https://www.npmjs.com/package/dockview)
11+
[![npm](https://img.shields.io/npm/dm/dockview)](https://www.npmjs.com/package/dockview)
1112
[![CI Build](https://github.com/mathuo/dockview/workflows/CI/badge.svg)](https://github.com/mathuo/dockview/actions?query=workflow%3ACI)
1213
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=mathuo_dockview&metric=coverage)](https://sonarcloud.io/summary/overall?id=mathuo_dockview)
1314
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mathuo_dockview&metric=alert_status)](https://sonarcloud.io/summary/overall?id=mathuo_dockview)
@@ -19,16 +20,20 @@ Please see the website: https://dockview.dev
1920

2021
## Features
2122

22-
- Simple splitviews, nested splitviews (i.e. gridviews) supporting full layout managment with
23-
dockable and tabular views
24-
- Extensive API support at the component level and view level
25-
- Themable and customizable
26-
- Serialization / deserialization support
27-
- Tabular docking and Drag and Drop support
28-
- Floating groups, customized header bars and tab
29-
- Documentation and examples
30-
31-
Want to inspect the latest deployment? Go to https://unpkg.com/browse/dockview@latest/
23+
- Serialization / deserialization with full layout management
24+
- Support for split-views, grid-views and 'dockable' views
25+
- Themeable and customizable
26+
- Tab and Group docking / Drag n' Drop
27+
- Popout Windows
28+
- Floating Groups
29+
- Extensive API
30+
- Supports Shadow DOMs
31+
- High test coverage
32+
- Documentation website with live examples
33+
- Transparent builds and Code Analysis
34+
- Security at mind - verifed publishing and builds through GitHub Actions
35+
36+
Want to verify our builds? Go [here](https://www.npmjs.com/package/dockview#Provenance).
3237

3338
## Quick start
3439

packages/docs/blog/2024-01-31-dockview-1.9.0.md packages/docs/blog/2024-01-15-dockview-1.9.0.md

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Please reference to docs @ [dockview.dev](https://dockview.dev).
1616

1717
- Advanced panel rendering configurations [#397](https://github.com/mathuo/dockview/issues/397)
1818

19+
- Support for rendering within Shadow DOM elements [#425](https://github.com/mathuo/dockview/issues/425)
20+
1921
## 🛠 Miscs
2022

2123
- Remove hover effect on inactive drag handles [#392](https://github.com/mathuo/dockview/pull/392)

packages/docs/docs/components/dockview.mdx

+47-13
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import DockviewFloating from '@site/sandboxes/floatinggroup-dockview/src/app';
2929
import DockviewLockedGroup from '@site/sandboxes/lockedgroup-dockview/src/app';
3030
import DockviewKeyboard from '@site/sandboxes/keyboard-dockview/src/app';
3131
import DockviewPopoutGroup from '@site/sandboxes/popoutgroup-dockview/src/app';
32+
import DockviewMaximizeGroup from '@site/sandboxes/maximizegroup-dockview/src/app';
3233
import DockviewRenderMode from '@site/sandboxes/rendermode-dockview/src/app';
3334

3435
import { DocRef } from '@site/src/components/ui/reference/docRef';
@@ -403,7 +404,7 @@ To programatically move the popout group back into the main grid you can use the
403404

404405
```tsx
405406
// option 1: add absolutely to the right-side of the grid
406-
props.group.api.moveTo({position: 'right'});
407+
props.group.api.moveTo({ position: 'right' });
407408

408409
// option 2: create a new group and move the contents of the popout group to it
409410
const group = props.containerApi.addGroup();
@@ -418,12 +419,44 @@ props.group.api.moveTo({ group });
418419

419420
## Maximized Groups
420421

421-
To maximize a group you can all
422+
To maximize a group from the component `api`:
422423

423424
```tsx
425+
// maximize a specified group
424426
api.maxmimizeGroup(group);
427+
428+
// check whether a specific group is maximized
429+
const result: boolean = api.isMaximizedGroup(group);
430+
431+
// if there is any maximized group exit the maximized state
432+
exitMaximizedGroup();
433+
434+
// is there a maximized group
435+
const result: boolean = hasMaximizedGroup();
436+
```
437+
438+
The following methods are available on both the panel and group `api` objects:
439+
440+
> `api.<method>` is equivalent to `api.group.api.<method>` for all of these methods. The methods exist on the panel `api` object for convenience.
441+
442+
```ts
443+
// maximize the group
444+
api.maximize();
445+
446+
// is this group maximized (if another group is maximized this method will still return false)
447+
const result: boolean = api.isMaxmized();
448+
449+
// exit only if this group is maximzied (if another group is maxmized this has no affect)
450+
api.exitMaximized();
425451
```
426452

453+
<MultiFrameworkContainer
454+
height={600}
455+
sandboxId="maximizegroup-dockview"
456+
react={DockviewMaximizeGroup}
457+
/>
458+
459+
427460
## Panels
428461

429462
### Add Panel
@@ -667,9 +700,9 @@ Toggling the checkbox you can see that when you only render those panels which a
667700
You can provide custom renderers for your tab headers for maximum customization.
668701
A default implementation of `DockviewDefaultTab` is provided should you only wish to attach minor
669702
changes and events that do not alter the default behaviour, for example to add a custom context menu event
670-
handler.
703+
handler or to hide the close button.
671704

672-
The `DockviewDefaulTab` component accepts a `hideClose` prop if you wish only to hide the close button.
705+
The `DockviewDefaultTab` component accepts a `hideClose` prop if you wish only to hide the close button.
673706

674707
```tsx title="Attaching a custom context menu event handlers to a custom header"
675708
import { IDockviewPanelHeaderProps, DockviewDefaultTab } from 'dockview';
@@ -679,7 +712,7 @@ const MyCustomheader = (props: IDockviewPanelHeaderProps) => {
679712
event.preventDefault();
680713
alert('context menu');
681714
};
682-
return <DockviewDefaultTab onContextMenu={onContextMenu} {...props} />;
715+
return <DockviewDefaultTab onContextMenu={onContextMenu} hideClose={true} {...props} />;
683716
};
684717
```
685718

@@ -900,16 +933,17 @@ iFrames required special attention because of a particular behaviour in how iFra
900933
901934
You can find many examples of discussions on this. Two reputable forums for example are linked [here](https://bugzilla.mozilla.org/show_bug.cgi?id=254144) and [here](https://github.com/whatwg/html/issues/5484).
902935

903-
The problem with iFrames and `dockview` is that when you hide or move a panel that panels DOM element may be moved within the DOM or removed from the DOM completely.
904-
If your panel contains an iFrame then that iFrame will reload after being re-positioned within the DOM tree and all state in that iFrame will most likely be lost.
905-
906-
`dockview` does not provide a built-in solution to this because it's too specific of a problem to include in the library.
907-
However the below example does show an implementation of a higher-order component `HoistedDockviewPanel`that you could use to work around this problems and make iFrames behave in `dockview`.
936+
To ensure iFrames work as expected you should render them in panels with `renderer: 'always'` to ensure they are never removed from the DOM, alternatively set the defaultRenderer to `always`.
908937

909-
What the higher-order component is doing is to hoist the panels contents into a DOM element that is always present and then `position: absolute` that element to match the dimensions of it's linked panel.
910-
The visibility of these hoisted elements is then controlled through some exposed api methods to hide elements that shouldn't be currently shown.
938+
> See the **Panel Rendering** section for more information of render modes.
911939
912-
You should open this example in CodeSandbox using the provided link to understand the code and make use of this implemention if required.
940+
```tsx title="Example of a panel using an alternative renderer"
941+
api.addPanel({
942+
id: 'my_panel_id',
943+
component: 'my_component',
944+
renderer: 'always',
945+
});
946+
```
913947

914948
<MultiFrameworkContainer
915949
sandboxId="iframe-dockview"

packages/docs/docs/contributing.mdx

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ description: Contributing
77

88
# Project description
99

10+
Pre-requisites: Node >=18, Yarn
11+
1012
Dockview is a layout manager library designed to provide a complete layouting solution.
1113
It is written in plain TypeScript and can be used without any framework although
1214
an extensive React wrapper has always and will always be provided for those using the React framework.

packages/docs/docs/index.mdx

+8-11
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ sidebar_position: 0
33
description: A zero dependency layout manager supporting ReactJS and Vanilla TypeScript
44
---
55

6+
import { MultiFrameworkContainer } from '@site/src/components/ui/container';
7+
68
import { SimpleSplitview } from '@site/src/components/simpleSplitview';
79
import { SimpleGridview } from '@site/src/components/simpleGridview';
810
import { SimplePaneview } from '@site/src/components/simplePaneview';
9-
import SimpleDockview from '@site/sandboxes/simple-dockview/src/app';
11+
import DockviewDemo from '@site/sandboxes/demo-dockview/src/app';
1012
import Link from '@docusaurus/Link';
1113

1214
# Introduction
@@ -34,16 +36,11 @@ There are 4 components you may want to use:
3436
<h2>Dockview</h2>
3537
</Link>
3638

37-
<div
38-
style={{
39-
height: '300px',
40-
backgroundColor: 'rgb(30,30,30)',
41-
color: 'white',
42-
margin: '20px 0px',
43-
}}
44-
>
45-
<SimpleDockview />
46-
</div>
39+
<MultiFrameworkContainer
40+
height={500}
41+
sandboxId="demo-dockview"
42+
react={DockviewDemo}
43+
/>
4744

4845
<Link to="./components/splitview">
4946
<h2>Splitview</h2>

0 commit comments

Comments
 (0)