chore: update docs

This commit is contained in:
mathuo 2025-07-25 22:36:57 +01:00
parent 84ec90ee68
commit ea62570b9a
No known key found for this signature in database
GPG Key ID: C6EEDEFD6CA07281
18 changed files with 13 additions and 516 deletions

View File

@ -7,7 +7,6 @@
],
"sandboxes": [
"/packages/docs/sandboxes/constraints-dockview",
"/packages/docs/sandboxes/customheader-dockview",
"/packages/docs/sandboxes/demo-dockview",
"/packages/docs/sandboxes/dnd-dockview",
"/packages/docs/sandboxes/dockview-app",

View File

@ -6,7 +6,6 @@ sidebar_position: 1
import useBaseUrl from '@docusaurus/useBaseUrl';
import { MultiFrameworkContainer } from '@site/src/components/ui/container';
import DockviewExternalDnd from '@site/sandboxes/externaldnd-dockview/src/app';
import LiveExample from '@site/src/components/ui/exampleFrame';
import { DocRef } from '@site/src/components/ui/reference/docRef';
@ -19,7 +18,7 @@ The dock makes heavy use of drag and drop functionalities.
]}
/>
<LiveExample framework='react' id='dockview/dnd-events' />
<CodeRunner framework='react' id='dockview/dnd-events' />
# Drag And Drop

View File

@ -6,7 +6,6 @@ sidebar_position: 3
External Dnd events can be intercepted through a number of utilities.
import { DocRef } from '@site/src/components/ui/reference/docRef';
import LiveExample from '@site/src/components/ui/exampleFrame';
<DocRef declaration="DockviewApi"
methods={['onDidDrop', 'onUnhandledDragOverEvent']}
@ -16,4 +15,4 @@ import LiveExample from '@site/src/components/ui/exampleFrame';
You can intercept drag events to attach your own metadata using the `onWillDragPanel` and `onWillDragGroup` api methods.
<LiveExample framework='react' id="dockview/dnd-external" />
<CodeRunner id="dockview/dnd-external" />

View File

@ -4,7 +4,6 @@ sidebar_position: 2
---
import { DocRef } from '@site/src/components/ui/reference/docRef';
import LiveExample from '@site/src/components/ui/exampleFrame';
This section describes how to update the parameters of a panel.

View File

@ -1,32 +0,0 @@
{
"name": "customheader-dockview",
"description": "",
"keywords": [
"dockview"
],
"version": "1.0.0",
"main": "src/index.tsx",
"dependencies": {
"dockview": "*",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"typescript": "^4.9.5",
"react-scripts": "*"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}

View File

@ -1,44 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

View File

@ -1,122 +0,0 @@
import {
DockviewDefaultTab,
DockviewReact,
DockviewReadyEvent,
IDockviewPanelHeaderProps,
IDockviewPanelProps,
} from 'dockview';
import * as React from 'react';
interface CustomProps {
valueA: string;
}
const components = {
default: (props: IDockviewPanelProps<CustomProps>) => {
return <div style={{ padding: '20px' }}>{props.api.title}</div>;
},
};
const headerComponents = {
default: (props: IDockviewPanelHeaderProps<CustomProps>) => {
const onContextMenu = (event: React.MouseEvent) => {
event.preventDefault();
alert(
`This custom header was parsed the params ${JSON.stringify(
props.params
)}`
);
};
return <DockviewDefaultTab onContextMenu={onContextMenu} {...props} />;
},
};
const CustomHeadersDockview = (props: { theme?: string }) => {
const onReady = (event: DockviewReadyEvent) => {
event.api.addPanel({
id: 'panel_1',
component: 'default',
title: 'Panel 1',
params: {
valueA: 'test value',
},
});
event.api.addPanel({
id: 'panel_2',
component: 'default',
title: 'Panel 2',
params: {
valueA: 'test value',
},
});
event.api.addPanel({
id: 'panel_3',
component: 'default',
title: 'Panel 3',
params: {
valueA: 'test value',
},
});
event.api.addPanel({
id: 'panel_4',
component: 'default',
title: 'Panel 4',
position: { referencePanel: 'panel_3', direction: 'right' },
params: {
valueA: 'test value',
},
});
event.api.addPanel({
id: 'panel_5',
component: 'default',
title: 'Panel 5',
position: { referencePanel: 'panel_4', direction: 'within' },
params: {
valueA: 'test value',
},
});
const panel6 = event.api.addPanel({
id: 'panel_6',
component: 'default',
title: 'Panel 6',
position: { referencePanel: 'panel_4', direction: 'below' },
params: {
valueA: 'test value',
},
});
panel6.group.locked = true;
panel6.group.header.hidden = true;
event.api.addPanel({
id: 'panel_7',
component: 'default',
title: 'Panel 7',
position: { referencePanel: 'panel_6', direction: 'right' },
params: {
valueA: 'test value',
},
});
event.api.addPanel({
id: 'panel_8',
component: 'default',
title: 'Panel 8',
position: { referencePanel: 'panel_7', direction: 'within' },
params: {
valueA: 'test value',
},
});
event.api.addGroup();
};
return (
<DockviewReact
components={components}
defaultTabComponent={headerComponents.default}
onReady={onReady}
className={`${props.theme || 'dockview-theme-abyss'}`}
/>
);
};
export default CustomHeadersDockview;

View File

@ -1,20 +0,0 @@
import { StrictMode } from 'react';
import * as ReactDOMClient from 'react-dom/client';
import './styles.css';
import 'dockview/dist/styles/dockview.css';
import App from './app';
const rootElement = document.getElementById('root');
if (rootElement) {
const root = ReactDOMClient.createRoot(rootElement);
root.render(
<StrictMode>
<div className="app">
<App />
</div>
</StrictMode>
);
}

View File

@ -1,16 +0,0 @@
body {
margin: 0px;
color: white;
font-family: sans-serif;
text-align: center;
}
#root {
height: 100vh;
width: 100vw;
}
.app {
height: 100%;
}

View File

@ -1,18 +0,0 @@
{
"compilerOptions": {
"outDir": "build/dist",
"module": "esnext",
"target": "es5",
"lib": ["es6", "dom"],
"sourceMap": true,
"allowJs": true,
"jsx": "react-jsx",
"moduleResolution": "node",
"rootDir": "src",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true
}
}

View File

@ -1,34 +0,0 @@
{
"name": "example-app-dockview",
"description": "",
"keywords": [
"dockview"
],
"version": "1.0.0",
"main": "src/index.tsx",
"dependencies": {
"ag-grid-community": "^31.0.2",
"ag-grid-react": "^31.0.2",
"dockview": "*",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"typescript": "^4.9.5",
"react-scripts": "*"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}

View File

@ -1,44 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

View File

@ -1,17 +0,0 @@
.my-custom-tab {
padding: 0px 8px;
width: 100%;
display: flex;
height: 100%;
align-items: center;
background-color: var(--dv-tabs-and-actions-container-background-color);
.my-custom-tab-icon {
font-size: 16px;
&:hover {
border-radius: 2px;
background-color: var(--dv-icon-hover-background-color);
}
}
}

View File

@ -1,90 +0,0 @@
import {
DockviewReact,
DockviewReadyEvent,
IDockviewPanelProps,
IDockviewPanelHeaderProps,
} from 'dockview';
import * as React from 'react';
import './app.scss';
import { AgGridReact } from 'ag-grid-react';
import { ColDef } from 'ag-grid-community';
import 'ag-grid-community/styles/ag-grid.css';
import 'ag-grid-community/styles/ag-theme-balham.css';
const data = new Array(1000).fill(0).map((_, i) => {
return {
index: i,
a: Math.random() * 100,
b: Math.random() * 100,
c: Math.random() * 100,
d: Math.random() * 100,
};
});
const columnDefs: ColDef[] = [
{
field: 'a',
},
{
field: 'b',
},
{
field: 'c',
},
{
field: 'd',
},
];
const components = {
default: (props: IDockviewPanelProps<{ title: string; x?: number }>) => {
return (
<div
style={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
color: 'white',
height: '100%',
}}
>
<span>{`${props.params.title}`}</span>
{props.params.x && <span>{` ${props.params.x}`}</span>}
</div>
);
},
grid: () => {
return (
<div className="ag-theme-balham-dark" style={{ height: '100%' }}>
<AgGridReact rowData={data} columnDefs={columnDefs} />
</div>
);
},
};
const DockviewComponent = (props: { theme?: string }) => {
const onReady = (event: DockviewReadyEvent) => {
const panel1 = event.api.addPanel({
id: 'panel_1',
component: 'default',
});
event.api.addPanel({
id: 'panel_2',
component: 'grid',
renderer: 'always',
});
};
return (
<DockviewReact
onReady={onReady}
components={components}
className={`${props.theme || 'dockview-theme-abyss'}`}
/>
);
};
export default DockviewComponent;

View File

@ -1,20 +0,0 @@
import { StrictMode } from 'react';
import * as ReactDOMClient from 'react-dom/client';
import './styles.css';
import 'dockview/dist/styles/dockview.css';
import App from './app';
const rootElement = document.getElementById('root');
if (rootElement) {
const root = ReactDOMClient.createRoot(rootElement);
root.render(
<StrictMode>
<div className="app">
<App />
</div>
</StrictMode>
);
}

View File

@ -1,16 +0,0 @@
body {
margin: 0px;
color: white;
font-family: sans-serif;
text-align: center;
}
#root {
height: 100vh;
width: 100vw;
}
.app {
height: 100%;
}

View File

@ -1,18 +0,0 @@
{
"compilerOptions": {
"outDir": "build/dist",
"module": "esnext",
"target": "es5",
"lib": ["es6", "dom"],
"sourceMap": true,
"allowJs": true,
"jsx": "react-jsx",
"moduleResolution": "node",
"rootDir": "src",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true
}
}

View File

@ -8,29 +8,21 @@ const BASE_SANDBOX_URL =
export const _CodeRunner = (props: { id: string; height: number }) => {
const [framework] = useActiveFramework();
let frameworkName = framework.label.toLowerCase();
if (frameworkName === 'javascript') {
frameworkName = 'typescript';
}
const sandboxUrl = `${BASE_SANDBOX_URL}/templates/${
props.id
}/${framework.label.toLowerCase()}`;
const path = `/templates/${
props.id
}/${framework.value.toLowerCase()}/index.html`;
const path = `/templates/${props.id}/${frameworkName}/index.html`;
return (
<div>
<iframe
src={path}
style={{ width: '100%', height: `${props.height ?? 300}px` }}
/>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<CodeSandbox url={sandboxUrl} />
<a
target="#blank"
href={path}
className="material-symbols-outlined"
>
open_in_new
</a>
</div>
</div>
<iframe
src={path}
style={{ width: '100%', height: `${props.height ?? 300}px` }}
/>
);
};