Skip to content

Commit 32d668f

Browse files
committed
chore: docs
1 parent 4b616c5 commit 32d668f

File tree

5 files changed

+1012
-833
lines changed

5 files changed

+1012
-833
lines changed

packages/docs/docs/components/dockview.mdx

+25-23
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ props.containerApi.addPopoutGroup(props.api.group);
395395
react={DockviewPopoutGroup}
396396
/>
397397

398-
399398
## Maximized Groups
400399

401400
To maximize a group you can all
@@ -563,18 +562,37 @@ api.removePanel(panel);
563562

564563
### Panel Rendering
565564

565+
#### Render Mode
566+
567+
Dockview has two rendering modes `onlyWhenVisible` (default) and `always`. A rendering mode can be defined through the `renderer` prop to `DockviewReact` or at an individual panel level when added where
568+
the panel declaration takes precedence if both are defined. Rendering modes defined at the panel level are persisted, those defined at the `DockviewReact` level are not persisted.
569+
570+
- `onlyWhenVisible` mode is the default mode. In this mode when a panel is no longer visible through either it's visiblity being hidden or it not being the active panel within a group the panels HTMLElement is removed
571+
from the DOM and any DOM state such as scrollbar positions will be lost. If you are using any ResizeObservers to measure size this will result both zero height and width as the HTMLElement no longer belongs to the DOM.
572+
This design allows for maximum performance at some cost.
573+
- `always` mode. In this mode when panels become hidden the HTMLElement is not destroyed so all DOM state such as scrollbar positions will be maintained. This is implemented by rendering each panel as an absolutely positioned
574+
HTMLElement and hidden the HTMLElement with `display: none` when it should be hidden.
575+
576+
<MultiFrameworkContainer
577+
height={500}
578+
sandboxId="rendermode-dockview"
579+
react={DockviewRenderMode}
580+
/>
581+
582+
####
583+
566584
By default `DockviewReact` only adds to the DOM those panels that are visible,
567585
if a panel is not the active tab and not shown the contents of the hidden panel will be removed from the DOM.
568586

569-
However the React Components associated with each panel are only created once and will always exist for as long as the panel exists, hidden or not.
587+
When a panel is in `onlyWhenVisible` render mode this only affects the contents within the DOM. The lifecycle of that panel instance is still maintained.
588+
The React Components associated with each panel are only created once and will always exist for as long as the panel exists, hidden or not.
570589

571-
> For example this means that any hooks in those components will run whether the panel is visible or not which may lead to excessive background work depending
590+
> e.g. This means that any hooks in those components will run whether the panel is visible or not which may lead to excessive background work depending
572591
> on the panels implementation.
573592
574-
This is the default behaviour to ensure the greatest flexibility for the user but through the panels `props.api` you can listen to the visiblity state of the panel
575-
and write additional logic to optimize your application.
593+
You can listen to the visiblity state of the panel and write additional logic to optimize your application if required, although this is an advanced case.
576594

577-
For example if you wanted to unmount the React Components when the panel is not visible you could create a Higher-Order-Component that listens to the panels
595+
If you wanted to unmount the React Components when the panel is not visible you could create a Higher-Order-Component that listens to the panels
578596
visiblity state and only renders the panel when visible.
579597

580598
```tsx title="Only rendering the React Component when the panel is visible, otherwise rendering a null React Component"
@@ -615,6 +633,7 @@ const components = { default: RenderWhenVisible(MyComponent) };
615633

616634
Toggling the checkbox you can see that when you only render those panels which are visible the underling React component is destroyed when it becomes hidden and re-created when it becomes visible.
617635

636+
618637
<MultiFrameworkContainer
619638
sandboxId="rendering-dockview"
620639
react={RenderingDockview}
@@ -851,23 +870,6 @@ api.group.api.setConstraints(...)
851870
react={DockviewConstraints}
852871
/>
853872

854-
## Render Mode
855-
856-
Dockview has two rendering modes `destructive` (default) and `gready`. A rendering mode can be defined through the `renderer` prop to `DockviewReact` or at an individual panel level when added where
857-
the panel declaration takes precedence if both are defined. Rendering modes defined at the panel level are persisted, those defined at the `DockviewReact` level are not persisted.
858-
859-
destructive
860-
- Destructive mode is the default mode. In this mode when a panel is no longer visible through either it's visiblity being hidden or it not being the active panel within a group the panels HTMLElement is removed
861-
from the DOM and any DOM state such as scrollbar positions will be lost. If you are using any ResizeObservers to measure size this will result both zero height and width as the HTMLElement no longer belongs to the DOM.
862-
This design allows for maximum performance at some cost.
863-
- Gready mode. In this mode when panels become hidden the HTMLElement is not destroyed so all DOM state such as scrollbar positions will be maintained. This is implemented by rendering each panel as an absolutely positioned
864-
HTMLElement and hidden the HTMLElement with `display: none` when it should be hidden.
865-
866-
<MultiFrameworkContainer
867-
height={500}
868-
sandboxId="rendermode-dockview"
869-
react={DockviewRenderMode}
870-
/>
871873

872874
## iFrames
873875

packages/docs/sandboxes/popoutgroup-dockview/src/app.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export const DockviewPersistance = (props: { theme?: string }) => {
145145
style={{
146146
display: 'flex',
147147
flexDirection: 'column',
148-
height: '400px',
148+
height: '100%',
149149
}}
150150
>
151151
<div style={{ height: '25px' }}>

packages/docs/src/components/ui/reference/docRef.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ type DocsComment = {
1717
type DocsJson = {
1818
[index: string]: Array<{
1919
name: string;
20-
signature: string;
20+
code: string;
2121
comment?: DocsComment;
22-
type: string;
22+
kind: 'accessor' | 'property' | 'method';
2323
}>;
2424
};
2525

@@ -150,7 +150,7 @@ export const DocRef = (props: DocRefProps) => {
150150
)}
151151
</div>
152152
<CodeBlock language="tsx">
153-
{doc.signature}
153+
{doc.code}
154154
</CodeBlock>
155155
</div>
156156
</th>

0 commit comments

Comments
 (0)