From ab5a11f13b973e7bb9023a884ab0ce389af4e058 Mon Sep 17 00:00:00 2001 From: mathuo <6710312+mathuo@users.noreply.github.com> Date: Wed, 28 Aug 2024 21:53:08 +0100 Subject: [PATCH] chore: docs --- packages/docs/docs/advanced/events.mdx | 12 - packages/docs/docs/core/dnd/external.mdx | 18 +- packages/docs/docs/core/overview.mdx | 9 + packages/docs/docs/core/panels/register.mdx | 33 +- packages/docs/docs/core/watermark.mdx | 2 +- .../docs/overview/getStarted/installation.mdx | 2 +- .../docs/docs/overview/getStarted/theme.mdx | 7 +- .../sandboxes/iframe-dockview/src/app.tsx | 24 +- .../react/dockview/demo-dockview/src/app.scss | 56 +- .../react/dockview/demo-dockview/src/app.tsx | 44 +- .../demo-dockview/src/gridActions.tsx | 130 ++++- .../demo-dockview/src/groupActions.tsx | 10 +- .../demo-dockview/src/panelBuilder.tsx | 115 ++++ .../docs/src/components/frameworkSpecific.tsx | 2 +- packages/docs/src/generated/api.output.json | 547 ++++++++++++++---- .../dockview/demo-dockview/react/src/app.tsx | 7 +- .../dockview/watermark/react/src/app.tsx | 3 +- .../watermark/typescript/src/index.ts | 135 +++++ 18 files changed, 953 insertions(+), 203 deletions(-) delete mode 100644 packages/docs/docs/advanced/events.mdx create mode 100644 packages/docs/sandboxes/react/dockview/demo-dockview/src/panelBuilder.tsx create mode 100644 packages/docs/templates/dockview/watermark/typescript/src/index.ts diff --git a/packages/docs/docs/advanced/events.mdx b/packages/docs/docs/advanced/events.mdx deleted file mode 100644 index e4edada93..000000000 --- a/packages/docs/docs/advanced/events.mdx +++ /dev/null @@ -1,12 +0,0 @@ -import { MultiFrameworkContainer } from '@site/src/components/ui/container'; -import EventsDockview from '@site/sandboxes/events-dockview/src/app'; - -# Events - -A simple example showing events fired by `dockviewz that can be interacted with. - - diff --git a/packages/docs/docs/core/dnd/external.mdx b/packages/docs/docs/core/dnd/external.mdx index 7e80d2dc7..7264446a1 100644 --- a/packages/docs/docs/core/dnd/external.mdx +++ b/packages/docs/docs/core/dnd/external.mdx @@ -9,25 +9,9 @@ import { DocRef } from '@site/src/components/ui/reference/docRef'; import LiveExample from '@site/src/components/ui/exampleFrame'; - - - - - - - - - - - - - - ## Intercepting Drag Events You can intercept drag events to attach your own metadata using the `onWillDragPanel` and `onWillDragGroup` api methods. diff --git a/packages/docs/docs/core/overview.mdx b/packages/docs/docs/core/overview.mdx index abedc5738..f3cf26628 100644 --- a/packages/docs/docs/core/overview.mdx +++ b/packages/docs/docs/core/overview.mdx @@ -8,6 +8,15 @@ This section provided a core overview. The component takes a collection of [Options](/docs/api/dockview/options) as inputs and once you have created a dock you can store a reference to the [API](/docs/api/dockview/overview) that is created. + + +```tsx +const element: HTMLElement +const options: DockviewComponentOptions +const api: DockviewApi = createDockview(element, options); +``` + + ```tsx function onReady(event: DockviewReadyEvent) { diff --git a/packages/docs/docs/core/panels/register.mdx b/packages/docs/docs/core/panels/register.mdx index 0b3b834be..5f90c7bb5 100644 --- a/packages/docs/docs/core/panels/register.mdx +++ b/packages/docs/docs/core/panels/register.mdx @@ -20,7 +20,7 @@ You can register panels through the dock [option](/docs/api/dockview/options) ` - + @@ -44,6 +44,37 @@ return + +```tsx +class Panel implements IContentRenderer { + private readonly _element: HTMLElement; + + get element(): HTMLElement { + return this._element; + } + + constructor() { + this._element = document.createElement('div'); + } + + init(parameters: GroupPanelPartInitParameters): void { + // + } +} + + +const api = createDockview(parentElement, { + createComponent: (options) => { + switch (options.name) { + case 'component_1': + return new Panel(); + } + }, +}); +``` + + + ```tsx const App = { diff --git a/packages/docs/docs/core/watermark.mdx b/packages/docs/docs/core/watermark.mdx index 7c8549ff3..e2416a6d8 100644 --- a/packages/docs/docs/core/watermark.mdx +++ b/packages/docs/docs/core/watermark.mdx @@ -25,7 +25,7 @@ The following properties can be set to configure the behaviours of floating grou diff --git a/packages/docs/docs/overview/getStarted/installation.mdx b/packages/docs/docs/overview/getStarted/installation.mdx index 4503011d6..2f0e97935 100644 --- a/packages/docs/docs/overview/getStarted/installation.mdx +++ b/packages/docs/docs/overview/getStarted/installation.mdx @@ -18,7 +18,7 @@ npm install dockview-core Firstly, install the `dockview` library: ```sh -npm install dockview +npm install dockview-react ``` diff --git a/packages/docs/docs/overview/getStarted/theme.mdx b/packages/docs/docs/overview/getStarted/theme.mdx index 06e9189c3..2e89eefe6 100644 --- a/packages/docs/docs/overview/getStarted/theme.mdx +++ b/packages/docs/docs/overview/getStarted/theme.mdx @@ -19,10 +19,15 @@ Firstly, you should import `dockview.css`: ```css -@import './node_modules/dockview/dist/styles/dockview.css'; +@import './node_modules/dockview-react/dist/styles/dockview.css'; ``` + +```css +@import './node_modules/dockview-vue/dist/styles/dockview.css'; +``` + ## Provided themes diff --git a/packages/docs/sandboxes/iframe-dockview/src/app.tsx b/packages/docs/sandboxes/iframe-dockview/src/app.tsx index 5a6587484..5e2b1a882 100644 --- a/packages/docs/sandboxes/iframe-dockview/src/app.tsx +++ b/packages/docs/sandboxes/iframe-dockview/src/app.tsx @@ -1,13 +1,33 @@ -import { DockviewReact, DockviewReadyEvent } from 'dockview'; +import { + DockviewReact, + DockviewReadyEvent, + IDockviewPanelProps, +} from 'dockview'; import * as React from 'react'; const components = { - iframeComponent: () => { + iframeComponent: (props: IDockviewPanelProps) => { + const [enabled, setEnabled] = React.useState( + props.api.isActive + ); + + React.useEffect(() => { + const disposable = props.api.onDidActiveChange((event) => { + setEnabled(event.isActive); + console.log(event); + }); + + return () => { + disposable.dispose(); + }; + }, [props.api]); + return (