From 58e9f9b355b12fd13977bade7c8326d3e1e1ecd7 Mon Sep 17 00:00:00 2001 From: mathuo <6710312+mathuo@users.noreply.github.com> Date: Mon, 9 Oct 2023 20:29:57 +0100 Subject: [PATCH] chore: improve docs --- .codesandbox/ci.json | 1 - .../dockview-core/src/api/component.api.ts | 366 ++++++- .../src/dnd/abstractDragHandler.ts | 22 +- .../src/dockview/components/tab/tab.ts | 7 + packages/docs/docs/components/dockview.mdx | 9 - .../sandboxes/events-dockview/src/app.tsx | 21 +- .../sandboxes/events-dockview/src/console.tsx | 2 +- .../docs/sandboxes/ide-example/package.json | 32 - .../sandboxes/ide-example/public/index.html | 44 - .../docs/sandboxes/ide-example/src/app.tsx | 154 --- .../docs/sandboxes/ide-example/src/index.tsx | 20 - .../docs/sandboxes/ide-example/src/styles.css | 15 - .../docs/sandboxes/ide-example/tsconfig.json | 18 - .../src/components/ui/reference/docRef.scss | 6 + .../src/components/ui/reference/docRef.tsx | 63 +- .../ui/reference/dockviewApi.reference.tsx | 171 ---- .../reference/dockviewPanelApi.reference.tsx | 103 -- .../src/components/ui/referenceTable.scss | 64 -- .../docs/src/components/ui/referenceTable.tsx | 196 ---- packages/docs/src/generated/api.output.json | 917 ++++++++++++++++++ .../version-1.8.4/components/dockview.mdx | 9 - scripts/docs.mjs | 5 +- 22 files changed, 1359 insertions(+), 886 deletions(-) delete mode 100644 packages/docs/sandboxes/ide-example/package.json delete mode 100644 packages/docs/sandboxes/ide-example/public/index.html delete mode 100644 packages/docs/sandboxes/ide-example/src/app.tsx delete mode 100644 packages/docs/sandboxes/ide-example/src/index.tsx delete mode 100644 packages/docs/sandboxes/ide-example/src/styles.css delete mode 100644 packages/docs/sandboxes/ide-example/tsconfig.json delete mode 100644 packages/docs/src/components/ui/reference/dockviewApi.reference.tsx delete mode 100644 packages/docs/src/components/ui/reference/dockviewPanelApi.reference.tsx delete mode 100644 packages/docs/src/components/ui/referenceTable.scss delete mode 100644 packages/docs/src/components/ui/referenceTable.tsx diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index 19e381168..38a11fd0b 100644 --- a/.codesandbox/ci.json +++ b/.codesandbox/ci.json @@ -15,7 +15,6 @@ "/packages/docs/sandboxes/floatinggroup-dockview", "/packages/docs/sandboxes/fullwidthtab-dockview", "/packages/docs/sandboxes/headeractions-dockview", - "/packages/docs/sandboxes/ide-example", "/packages/docs/sandboxes/groupcontol-dockview", "/packages/docs/sandboxes/iframe-dockview", "/packages/docs/sandboxes/keyboard-dockview", diff --git a/packages/dockview-core/src/api/component.api.ts b/packages/dockview-core/src/api/component.api.ts index 6229625ad..c46a2aa56 100644 --- a/packages/dockview-core/src/api/component.api.ts +++ b/packages/dockview-core/src/api/component.api.ts @@ -56,132 +56,224 @@ export interface CommonApi { } export class SplitviewApi implements CommonApi { + /** + * The minimum size the component can reach where size is measured in the direction of orientation provided. + */ get minimumSize(): number { return this.component.minimumSize; } + /** + * The maximum size the component can reach where size is measured in the direction of orientation provided. + */ get maximumSize(): number { return this.component.maximumSize; } - get height(): number { - return this.component.height; - } - + /** + * Width of the component. + */ get width(): number { return this.component.width; } + /** + * Height of the component. + */ + get height(): number { + return this.component.height; + } + /** + * The current number of panels. + */ get length(): number { return this.component.length; } + /** + * The current orientation of the component. + */ get orientation(): Orientation { return this.component.orientation; } + /** + * The list of current panels. + */ get panels(): ISplitviewPanel[] { return this.component.panels; } + /** + * Invoked after a layout is loaded through the `fromJSON` method. + */ get onDidLayoutFromJSON(): Event { return this.component.onDidLayoutFromJSON; } + /** + * Invoked whenever any aspect of the layout changes. + * If listening to this event it may be worth debouncing ouputs. + */ get onDidLayoutChange(): Event { return this.component.onDidLayoutChange; } + /** + * Invoked when a view is added. + */ get onDidAddView(): Event { return this.component.onDidAddView; } + /** + * Invoked when a view is removed. + */ get onDidRemoveView(): Event { return this.component.onDidRemoveView; } constructor(private readonly component: ISplitviewComponent) {} + /** + * Update configuratable options. + */ updateOptions(options: SplitviewComponentUpdateOptions): void { this.component.updateOptions(options); } + /** + * Removes an existing panel and optionally provide a `Sizing` method + * for the subsequent resize. + */ removePanel(panel: ISplitviewPanel, sizing?: Sizing): void { this.component.removePanel(panel, sizing); } + /** + * Focus the component. + */ focus(): void { this.component.focus(); } + /** + * Get the reference to a panel given it's `string` id. + */ getPanel(id: string): ISplitviewPanel | undefined { return this.component.getPanel(id); } + /** + * Layout the panel with a width and height. + */ layout(width: number, height: number): void { return this.component.layout(width, height); } + /** + * Add a new panel and return the created instance. + */ addPanel( options: AddSplitviewComponentOptions ): ISplitviewPanel { return this.component.addPanel(options); } + /** + * Move a panel given it's current and desired index. + */ movePanel(from: number, to: number): void { this.component.movePanel(from, to); } + /** + * Deserialize a layout to built a splitivew. + */ fromJSON(data: SerializedSplitview): void { this.component.fromJSON(data); } + /** Serialize a layout */ toJSON(): SerializedSplitview { return this.component.toJSON(); } + /** + * Remove all panels and clear the component. + */ clear(): void { this.component.clear(); } } export class PaneviewApi implements CommonApi { + /** + * The minimum size the component can reach where size is measured in the direction of orientation provided. + */ get minimumSize(): number { return this.component.minimumSize; } + /** + * The maximum size the component can reach where size is measured in the direction of orientation provided. + */ get maximumSize(): number { return this.component.maximumSize; } - get height(): number { - return this.component.height; - } - + /** + * Width of the component. + */ get width(): number { return this.component.width; } + /** + * Height of the component. + */ + get height(): number { + return this.component.height; + } + + /** + * All panel objects. + */ get panels(): IPaneviewPanel[] { return this.component.panels; } + /** + * Invoked when any layout change occures, an aggregation of many events. + */ get onDidLayoutChange(): Event { return this.component.onDidLayoutChange; } + /** + * Invoked after a layout is deserialzied using the `fromJSON` method. + */ get onDidLayoutFromJSON(): Event { return this.component.onDidLayoutFromJSON; } + /** + * Invoked when a panel is added. May be called multiple times when moving panels. + */ get onDidAddView(): Event { return this.component.onDidAddView; } + /** + * Invoked when a panel is removed. May be called multiple times when moving panels. + */ get onDidRemoveView(): Event { return this.component.onDidRemoveView; } + /** + * Invoked when a Drag'n'Drop event occurs that the component was unable to handle. Exposed for custom Drag'n'Drop functionality. + */ get onDidDrop(): Event { const emitter = new Emitter(); @@ -199,94 +291,160 @@ export class PaneviewApi implements CommonApi { constructor(private readonly component: IPaneviewComponent) {} + /** + * Remove a panel given the panel object. + */ removePanel(panel: IPaneviewPanel): void { this.component.removePanel(panel); } + /** + * Get a panel object given a `string` id. May return `undefined`. + */ getPanel(id: string): IPaneviewPanel | undefined { return this.component.getPanel(id); } + /** + * Move a panel given it's current and desired index. + */ movePanel(from: number, to: number): void { this.component.movePanel(from, to); } + /** + * Focus the component. Will try to focus an active panel if one exists. + */ focus(): void { this.component.focus(); } + /** + * Force resize the component to an exact width and height. Read about auto-resizing before using. + */ layout(width: number, height: number): void { this.component.layout(width, height); } + /** + * Add a panel and return the created object. + */ addPanel( options: AddPaneviewComponentOptions ): IPaneviewPanel { return this.component.addPanel(options); } + /** + * Create a component from a serialized object. + */ fromJSON(data: SerializedPaneview): void { this.component.fromJSON(data); } + /** + * Create a serialized object of the current component. + */ toJSON(): SerializedPaneview { return this.component.toJSON(); } + /** + * Reset the component back to an empty and default state. + */ clear(): void { this.component.clear(); } } export class GridviewApi implements CommonApi { - get minimumHeight(): number { - return this.component.minimumHeight; - } - - get maximumHeight(): number { - return this.component.maximumHeight; - } - - get minimumWidth(): number { - return this.component.minimumWidth; - } - - get maximumWidth(): number { - return this.component.maximumWidth; - } - + /** + * Width of the component. + */ get width(): number { return this.component.width; } + /** + * Height of the component. + */ get height(): number { return this.component.height; } + /** + * Minimum height of the component. + */ + get minimumHeight(): number { + return this.component.minimumHeight; + } + + /** + * Maximum height of the component. + */ + get maximumHeight(): number { + return this.component.maximumHeight; + } + + /** + * Minimum width of the component. + */ + get minimumWidth(): number { + return this.component.minimumWidth; + } + + /** + * Maximum width of the component. + */ + get maximumWidth(): number { + return this.component.maximumWidth; + } + + /** + * Invoked when any layout change occures, an aggregation of many events. + */ get onDidLayoutChange(): Event { return this.component.onDidLayoutChange; } + /** + * Invoked when a panel is added. May be called multiple times when moving panels. + */ get onDidAddPanel(): Event { return this.component.onDidAddGroup; } + /** + * Invoked when a panel is removed. May be called multiple times when moving panels. + */ get onDidRemovePanel(): Event { return this.component.onDidRemoveGroup; } + /** + * Invoked when the active panel changes. May be undefined if no panel is active. + */ get onDidActivePanelChange(): Event { return this.component.onDidActiveGroupChange; } + /** + * Invoked after a layout is deserialzied using the `fromJSON` method. + */ get onDidLayoutFromJSON(): Event { return this.component.onDidLayoutFromJSON; } + /** + * All panel objects. + */ get panels(): IGridviewPanel[] { return this.component.groups; } + /** + * Current orientation. Can be changed after initialization. + */ get orientation(): Orientation { return this.component.orientation; } @@ -297,24 +455,39 @@ export class GridviewApi implements CommonApi { constructor(private readonly component: IGridviewComponent) {} + /** + * Focus the component. Will try to focus an active panel if one exists. + */ focus(): void { this.component.focus(); } + /** + * Force resize the component to an exact width and height. Read about auto-resizing before using. + */ layout(width: number, height: number, force = false): void { this.component.layout(width, height, force); } + /** + * Add a panel and return the created object. + */ addPanel( options: AddComponentOptions ): IGridviewPanel { return this.component.addPanel(options); } + /** + * Remove a panel given the panel object. + */ removePanel(panel: IGridviewPanel, sizing?: Sizing): void { this.component.removePanel(panel, sizing); } + /** + * Move a panel in a particular direction relative to another panel. + */ movePanel( panel: IGridviewPanel, options: { direction: Direction; reference: string; size?: number } @@ -322,168 +495,274 @@ export class GridviewApi implements CommonApi { this.component.movePanel(panel, options); } + /** + * Get a panel object given a `string` id. May return `undefined`. + */ getPanel(id: string): IGridviewPanel | undefined { return this.component.getPanel(id); } + /** + * Create a component from a serialized object. + */ fromJSON(data: SerializedGridviewComponent): void { return this.component.fromJSON(data); } + /** + * Create a serialized object of the current component. + */ toJSON(): SerializedGridviewComponent { return this.component.toJSON(); } + /** + * Reset the component back to an empty and default state. + */ clear(): void { this.component.clear(); } } export class DockviewApi implements CommonApi { + /** + * The unique identifier for this instance. Used to manage scope of Drag'n'Drop events. + */ get id(): string { return this.component.id; } + /** + * Width of the component. + */ get width(): number { return this.component.width; } + /** + * Height of the component. + */ get height(): number { return this.component.height; } + /** + * Minimum height of the component. + */ get minimumHeight(): number { return this.component.minimumHeight; } + /** + * Maximum height of the component. + */ get maximumHeight(): number { return this.component.maximumHeight; } + /** + * Minimum width of the component. + */ get minimumWidth(): number { return this.component.minimumWidth; } + /** + * Maximum width of the component. + */ get maximumWidth(): number { return this.component.maximumWidth; } + /** + * Total number of groups. + */ get size(): number { return this.component.size; } + /** + * Total number of panels. + */ get totalPanels(): number { return this.component.totalPanels; } + /** + * Invoked when the active group changes. May be undefined if no group is active. + */ get onDidActiveGroupChange(): Event { return this.component.onDidActiveGroupChange; } + /** + * Invoked when a group is added. May be called multiple times when moving groups. + */ get onDidAddGroup(): Event { return this.component.onDidAddGroup; } + /** + * Invoked when a group is removed. May be called multiple times when moving groups. + */ get onDidRemoveGroup(): Event { return this.component.onDidRemoveGroup; } + /** + * Invoked when the active panel changes. May be undefined if no panel is active. + */ get onDidActivePanelChange(): Event { return this.component.onDidActivePanelChange; } + /** + * Invoked when a panel is added. May be called multiple times when moving panels. + */ get onDidAddPanel(): Event { return this.component.onDidAddPanel; } + /** + * Invoked when a panel is removed. May be called multiple times when moving panels. + */ get onDidRemovePanel(): Event { return this.component.onDidRemovePanel; } + /** + * Invoked after a layout is deserialzied using the `fromJSON` method. + */ get onDidLayoutFromJSON(): Event { return this.component.onDidLayoutFromJSON; } + /** + * Invoked when any layout change occures, an aggregation of many events. + */ get onDidLayoutChange(): Event { return this.component.onDidLayoutChange; } + /** + * Invoked when a Drag'n'Drop event occurs that the component was unable to handle. Exposed for custom Drag'n'Drop functionality. + */ get onDidDrop(): Event { return this.component.onDidDrop; } + /** + * Invoked before a group is dragged. Exposed for custom Drag'n'Drop functionality. + */ get onWillDragGroup(): Event { return this.component.onWillDragGroup; } + /** + * Invoked before a panel is dragged. Exposed for custom Drag'n'Drop functionality. + */ get onWillDragPanel(): Event { return this.component.onWillDragPanel; } + /** + * All panel objects. + */ get panels(): IDockviewPanel[] { return this.component.panels; } + /** + * All group objects. + */ get groups(): DockviewGroupPanel[] { return this.component.groups; } + /** + * Active panel object. + */ get activePanel(): IDockviewPanel | undefined { return this.component.activePanel; } + /** + * Active group object. + */ get activeGroup(): DockviewGroupPanel | undefined { return this.component.activeGroup; } constructor(private readonly component: IDockviewComponent) {} + /** + * Focus the component. Will try to focus an active panel if one exists. + */ focus(): void { this.component.focus(); } + /** + * Get a panel object given a `string` id. May return `undefined`. + */ getPanel(id: string): IDockviewPanel | undefined { return this.component.getGroupPanel(id); } + /** + * Force resize the component to an exact width and height. Read about auto-resizing before using. + */ layout(width: number, height: number, force = false): void { this.component.layout(width, height, force); } + /** + * Add a panel and return the created object. + */ addPanel( options: AddPanelOptions ): IDockviewPanel { return this.component.addPanel(options); } + /** + * Remove a panel given the panel object. + */ removePanel(panel: IDockviewPanel): void { this.component.removePanel(panel); } + /** + * Add a group and return the created object. + */ addGroup(options?: AddGroupOptions): DockviewGroupPanel { return this.component.addGroup(options); } - moveToNext(options?: MovementOptions): void { - this.component.moveToNext(options); - } - - moveToPrevious(options?: MovementOptions): void { - this.component.moveToPrevious(options); - } - + /** + * Close all groups and panels. + */ closeAllGroups(): void { return this.component.closeAllGroups(); } + /** + * Remove a group and any panels within the group. + */ removeGroup(group: IDockviewGroupPanel): void { this.component.removeGroup(group); } + /** + * Get a group object given a `string` id. May return undefined. + */ getGroup(id: string): DockviewGroupPanel | undefined { return this.component.getPanel(id); } + /** + * Add a floating group + */ addFloatingGroup( item: IDockviewPanel | DockviewGroupPanel, coord?: { x: number; y: number } @@ -491,15 +770,38 @@ export class DockviewApi implements CommonApi { return this.component.addFloatingGroup(item, coord); } + /** + * Create a component from a serialized object. + */ fromJSON(data: SerializedDockview): void { this.component.fromJSON(data); } + /** + * Create a serialized object of the current component. + */ toJSON(): SerializedDockview { return this.component.toJSON(); } + /** + * Reset the component back to an empty and default state. + */ clear(): void { this.component.clear(); } + + /** + * Move the focus progmatically to the next panel or group. + */ + moveToNext(options?: MovementOptions): void { + this.component.moveToNext(options); + } + + /** + * Move the focus progmatically to the previous panel or group. + */ + moveToPrevious(options?: MovementOptions): void { + this.component.moveToPrevious(options); + } } diff --git a/packages/dockview-core/src/dnd/abstractDragHandler.ts b/packages/dockview-core/src/dnd/abstractDragHandler.ts index 306ab236e..f4700a636 100644 --- a/packages/dockview-core/src/dnd/abstractDragHandler.ts +++ b/packages/dockview-core/src/dnd/abstractDragHandler.ts @@ -6,6 +6,8 @@ import { MutableDisposable, } from '../lifecycle'; +const CLONE_ELEMENT = true; + export abstract class DragHandler extends CompositeDisposable { private readonly dataDisposable = new MutableDisposable(); private readonly pointerEventsDisposable = new MutableDisposable(); @@ -57,8 +59,24 @@ export abstract class DragHandler extends CompositeDisposable { iframe.style.pointerEvents = 'none'; } - this.el.classList.add('dv-dragged'); - setTimeout(() => this.el.classList.remove('dv-dragged'), 0); + if (CLONE_ELEMENT && event.dataTransfer) { + const clone = this.el.cloneNode(true) as HTMLElement; + const styles = window.getComputedStyle(this.el); + clone.style.cssText = Object.values(styles) + .map((key) => `${key}:${styles.getPropertyValue(key)}`) + .join(';'); + clone.classList.add('dv-dragged'); + + document.body.append(clone); + setTimeout(() => { + // clone.parentElement?.removeChild(clone); + }, 0); + + event.dataTransfer.setDragImage(clone, 0, 0); + } else { + this.el.classList.add('dv-dragged'); + setTimeout(() => this.el.classList.remove('dv-dragged'), 0); + } this.dataDisposable.value = this.getData(event); this._onDragStart.fire(event); diff --git a/packages/dockview-core/src/dockview/components/tab/tab.ts b/packages/dockview-core/src/dockview/components/tab/tab.ts index 48da83a85..4f8c9430f 100644 --- a/packages/dockview-core/src/dockview/components/tab/tab.ts +++ b/packages/dockview-core/src/dockview/components/tab/tab.ts @@ -24,6 +24,13 @@ class TabDragHandler extends DragHandler { private readonly panel: IDockviewPanel ) { super(element); + + this.onDragStart((e) => { + this.accessor.removePanel(this.panel, { + skipDispose: true, + removeEmptyGroup: true, + }); + }); } getData(event: DragEvent): IDisposable { diff --git a/packages/docs/docs/components/dockview.mdx b/packages/docs/docs/components/dockview.mdx index 9c9ac1ed9..6c9528f88 100644 --- a/packages/docs/docs/components/dockview.mdx +++ b/packages/docs/docs/components/dockview.mdx @@ -27,7 +27,6 @@ import DockviewTabheight from '@site/sandboxes/tabheight-dockview/src/app'; import DockviewWithIFrames from '@site/sandboxes/iframe-dockview/src/app'; import DockviewFloating from '@site/sandboxes/floatinggroup-dockview/src/app'; import DockviewLockedGroup from '@site/sandboxes/lockedgroup-dockview/src/app'; -import IDEExample from '@site/sandboxes/ide-example/src/app'; import DockviewKeyboard from '@site/sandboxes/keyboard-dockview/src/app'; import { DocRef, Markdown } from '@site/src/components/ui/reference/docRef'; @@ -862,14 +861,6 @@ Keyboard shortcuts react={DockviewKeyboard} /> -## Application with sidebars - - - ### Nested Dockviews You can safely create multiple dockview instances within one page and nest dockviews within other dockviews. diff --git a/packages/docs/sandboxes/events-dockview/src/app.tsx b/packages/docs/sandboxes/events-dockview/src/app.tsx index 0fa3079b2..5605a1bd8 100644 --- a/packages/docs/sandboxes/events-dockview/src/app.tsx +++ b/packages/docs/sandboxes/events-dockview/src/app.tsx @@ -318,14 +318,17 @@ const EventsDockview = (props: { theme?: string }) => { height: '100%', }} > - +
+ + +
{ className={`${props.theme || 'dockview-theme-abyss'}`} />
-
+
diff --git a/packages/docs/sandboxes/events-dockview/src/console.tsx b/packages/docs/sandboxes/events-dockview/src/console.tsx index c936a1476..8311a9468 100644 --- a/packages/docs/sandboxes/events-dockview/src/console.tsx +++ b/packages/docs/sandboxes/events-dockview/src/console.tsx @@ -20,7 +20,7 @@ export interface IConsoleProps { } export const Console = (props: IConsoleProps) => { - const ref = React.useRef(); + const ref = React.useRef(null); React.useLayoutEffect(() => { if (!ref.current) { diff --git a/packages/docs/sandboxes/ide-example/package.json b/packages/docs/sandboxes/ide-example/package.json deleted file mode 100644 index 5de7b1222..000000000 --- a/packages/docs/sandboxes/ide-example/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "ide-example", - "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" - ] -} diff --git a/packages/docs/sandboxes/ide-example/public/index.html b/packages/docs/sandboxes/ide-example/public/index.html deleted file mode 100644 index 1f8a52426..000000000 --- a/packages/docs/sandboxes/ide-example/public/index.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - React App - - - - -
- - - - diff --git a/packages/docs/sandboxes/ide-example/src/app.tsx b/packages/docs/sandboxes/ide-example/src/app.tsx deleted file mode 100644 index d63b035f8..000000000 --- a/packages/docs/sandboxes/ide-example/src/app.tsx +++ /dev/null @@ -1,154 +0,0 @@ -import { - GridviewReact, - GridviewReadyEvent, - IGridviewPanelProps, - GridviewComponent, - Orientation, - GridviewApi, - LayoutPriority, -} from 'dockview'; -import * as React from 'react'; - -const components = { - 'left-sidebar': (props: IGridviewPanelProps<{ title: string }>) => { - return ( -
- {props.params.title} -
- ); - }, - 'middle-content': (props: IGridviewPanelProps<{ title: string }>) => { - return ( -
- {props.params.title} -
- ); - }, - 'right-sidebar': (props: IGridviewPanelProps<{ title: string }>) => { - return ( -
- {props.params.title} -
- ); - }, -}; - -const App = (props: { theme?: string }) => { - const [api, setApi] = React.useState(); - - const onReady = (event: GridviewReadyEvent) => { - event.api.fromJSON({ - grid: { - height: 1000, - width: 1000, - orientation: Orientation.HORIZONTAL, - root: { - type: 'branch', - data: [ - { - type: 'leaf', - data: { - id: 'left-sidebar-id', - component: 'left-sidebar', - snap: true, - minimumWidth: 100, - }, - size: 200, - }, - { - type: 'leaf', - data: { - id: 'middle-content-id', - component: 'middle-content', - priority: LayoutPriority.High, - minimumWidth: 100, - }, - size: 600, - }, - { - type: 'leaf', - data: { - id: 'right-sidebar-id', - component: 'right-sidebar', - snap: true, - minimumWidth: 100, - }, - size: 200, - }, - ], - }, - }, - }); - - setApi(event.api); - }; - - const onKeyPress = (event: React.KeyboardEvent) => { - if (!api) { - return; - } - - if (event.ctrlKey) { - if (event.code === 'ArrowLeft') { - const leftSidebarPanel = api.getPanel('left-sidebar-id'); - - if (leftSidebarPanel) { - leftSidebarPanel.api.setVisible(false); - } - } - } - - if (event.code === 'ArrowRight') { - const leftSidebarPanel = api.getPanel('left-sidebar-id'); - - if (leftSidebarPanel) { - leftSidebarPanel.api.setVisible(true); - } - } - }; - - return ( -
-
- {'Use '} - {'Ctrl+ArrowLeft'} - {' and '} - {'Ctrl+ArrowRight'} - { - ' to show and hide the left sidebar. The right sidebar can be hidden by dragging it to the right.' - } -
-
- -
-
- ); -}; - -export default App; diff --git a/packages/docs/sandboxes/ide-example/src/index.tsx b/packages/docs/sandboxes/ide-example/src/index.tsx deleted file mode 100644 index 2fe1be232..000000000 --- a/packages/docs/sandboxes/ide-example/src/index.tsx +++ /dev/null @@ -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( - -
- -
-
- ); -} diff --git a/packages/docs/sandboxes/ide-example/src/styles.css b/packages/docs/sandboxes/ide-example/src/styles.css deleted file mode 100644 index 2198f8a37..000000000 --- a/packages/docs/sandboxes/ide-example/src/styles.css +++ /dev/null @@ -1,15 +0,0 @@ -body { - margin: 0px; - font-family: sans-serif; - text-align: center; -} - -#root { - height: 100vh; - width: 100vw; -} - -.app { - height: 100%; - -} diff --git a/packages/docs/sandboxes/ide-example/tsconfig.json b/packages/docs/sandboxes/ide-example/tsconfig.json deleted file mode 100644 index cdc4fb5f5..000000000 --- a/packages/docs/sandboxes/ide-example/tsconfig.json +++ /dev/null @@ -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 - } -} diff --git a/packages/docs/src/components/ui/reference/docRef.scss b/packages/docs/src/components/ui/reference/docRef.scss index 1392042b9..ea4fd230d 100644 --- a/packages/docs/src/components/ui/reference/docRef.scss +++ b/packages/docs/src/components/ui/reference/docRef.scss @@ -37,4 +37,10 @@ } } } + + .doc-text { + font-size: 1em; + font-weight: 400; + margin-bottom: 8px; + } } diff --git a/packages/docs/src/components/ui/reference/docRef.tsx b/packages/docs/src/components/ui/reference/docRef.tsx index d7e25b1de..7f3c5d9f2 100644 --- a/packages/docs/src/components/ui/reference/docRef.tsx +++ b/packages/docs/src/components/ui/reference/docRef.tsx @@ -9,18 +9,66 @@ export interface DocRefProps { import docsJson from '../../../generated/api.output.json'; type DocsContent = { kind: string; text: string; tag?: string }; +type DocsTag = { tag: string; content: DocsContent[] }; +type DocsComment = { + summary?: DocsContent[]; + blockTags?: DocsTag[]; +}; type DocsJson = { [index: string]: Array<{ name: string; signature: string; - comment?: { - summary?: DocsContent[]; - blockTags?: Array<{ tag: string; content: DocsContent }>; - }; + comment?: DocsComment; type: string; }>; }; +export const Text = (props: { content: DocsContent[] }) => { + return ( +
+ {props.content.map((piece, i) => { + switch (piece.kind) { + case 'text': { + return {piece.text}; + } + case 'code': + return ( + + {piece.text.substring(1, piece.text.length - 1)} + + ); + default: + throw new Error(`unhandled piece ${piece.kind}`); + } + })} +
+ ); +}; + +export const Tags = (props: { tags: DocsTag[] }) => { + return ( +
+ {props.tags.map((tag, i) => { + return ( +
+
{tag.tag}
+ +
+ ); + })} +
+ ); +}; + +export const Summary = (props: { summary: DocsComment }) => { + return ( +
+ + {/* */} +
+ ); +}; + export const Markdown = (props: { children: string }) => { return {props.children}; }; @@ -94,6 +142,13 @@ export const DocRef = (props: DocRefProps) => { > {/*
{'-'}
*/}
+
+ {doc.comment && ( + + )} +
{doc.signature} diff --git a/packages/docs/src/components/ui/reference/dockviewApi.reference.tsx b/packages/docs/src/components/ui/reference/dockviewApi.reference.tsx deleted file mode 100644 index a281053c7..000000000 --- a/packages/docs/src/components/ui/reference/dockviewApi.reference.tsx +++ /dev/null @@ -1,171 +0,0 @@ -import { ReactPropDocsTable } from '../referenceTable'; -import * as React from 'react'; - -export default () => ( - ', - }, - { - property: 'onDidAddGroup', - type: 'Event', - }, - { - property: 'onDidRemoveGroup', - type: 'Event', - }, - { - property: 'onDidActivePanelChange', - type: 'Event', - }, - { - property: 'onDidAddPanel', - type: 'Event', - }, - { - property: 'onDidRemovePanel', - type: 'Event', - }, - { - property: 'onDidLayoutFromJSON', - type: 'Event', - }, - { - property: 'onDidLayoutChange', - type: 'Event', - }, - { - property: 'onDidDrop', - type: 'Event', - }, - { - property: 'onWillDragGroup', - type: 'Event', - }, - { - property: 'onWillDragPanel', - type: 'Event', - }, - { - property: 'panels', - type: 'IDockviewPanel[]', - }, - { - property: 'groups', - type: 'DockviewGroupPanel[]', - }, - { - property: 'activePanel', - type: 'IDockviewPanel | undefined', - }, - { - property: 'activeGroup', - type: 'DockviewGroupPanel | undefined', - }, - { - property: 'focus', - type: '(): void', - }, - { - property: 'getPanel', - type: '(id: string): IDockviewPanel | undefined', - }, - { - property: 'layout', - type: '(width: number, height: number): void', - }, - { - property: 'addPanel', - type: 'addPanel(options: AddPanelOptions): void', - }, - { - property: 'removePanel', - type: '(panel: IDockviewPanel): void', - }, - { - property: 'addGroup', - type: '(options?: AddGroupOptions): DockviewGroupPanel', - }, - { - property: 'moveToNext', - type: '(options?: MovementOptions): void', - }, - { - property: 'moveToPrevious', - type: '(options?: MovementOptions): void', - }, - { - property: 'closeAllGroups', - type: '(): void', - }, - { - property: 'removeGroup', - type: '(group: IDockviewGroupPanel): void ', - }, - { - property: 'getGroup', - type: '(id: string): DockviewGroupPanel | undefined', - }, - { - property: 'addFloatingGroup', - type: '(item: IDockviewPanel | DockviewGroupPanel, coord?: { x: number, y: number }): void', - }, - { - property: 'fromJSON', - type: '(data: SerializedDockview): void', - }, - { - property: 'toJSON', - type: '(): SerializedDockview ', - }, - { - property: 'clear', - type: '(): void', - }, - ]} - /> -); diff --git a/packages/docs/src/components/ui/reference/dockviewPanelApi.reference.tsx b/packages/docs/src/components/ui/reference/dockviewPanelApi.reference.tsx deleted file mode 100644 index 786171dcf..000000000 --- a/packages/docs/src/components/ui/reference/dockviewPanelApi.reference.tsx +++ /dev/null @@ -1,103 +0,0 @@ -import { ReactPropDocsTable } from '../referenceTable'; -import * as React from 'react'; - -export default () => ( - ', - }, - { - property: 'onDidGroupChange', - type: 'Event', - }, - { - property: 'close', - type: '(): void', - }, - { - property: 'setTitle', - type: '(title: string): void', - }, - { - property: 'moveTo', - type: '(options: { group: DockviewGroupPanel, position?: Position, index?: number }): void', - }, - { - property: 'setSize', - type: '(event: SizeEvent): void', - }, - { - property: 'onDidDimensionsChange', - type: 'Event', - }, - { - property: 'onDidFocusChange', - type: 'Event', - }, - { - property: 'onDidVisibilityChange', - type: 'Event', - }, - { - property: 'onDidActiveChange', - type: 'Event', - }, - { - property: 'setVisible', - type: '(isVisible: boolean): void', - }, - { - property: 'setActive', - type: '(): void', - }, - { - property: 'updateParameters', - type: '(parameters: Parameters): void', - }, - { - property: 'id', - type: 'string', - }, - { - property: 'isFocused', - type: 'boolean', - }, - { - property: 'isActive', - type: 'boolean', - }, - { - property: 'isVisible', - type: 'boolean', - }, - { - property: 'width', - type: 'number', - }, - { - property: 'height', - type: 'number', - }, - ]} - /> -); diff --git a/packages/docs/src/components/ui/referenceTable.scss b/packages/docs/src/components/ui/referenceTable.scss deleted file mode 100644 index dc3af03a7..000000000 --- a/packages/docs/src/components/ui/referenceTable.scss +++ /dev/null @@ -1,64 +0,0 @@ -.ref-table { - font-size: 12px; - width: 100%; - border-collapse: collapse; - - line-height: 20px; - - button { - all: unset; - } - - code { - padding: 0px 4px; - margin: 0px 4px; - } - - .ref-table-icon { - cursor: pointer; - } - - .ref-table-property { - width: 30%; - } - - .ref-table-type { - width: 50%; - } - - .ref-table-default { - width: 20%; - } - - thead { - text-align: left; - background-color: inherit; - - tr { - border: none; - } - } - - th, - td { - border: none; - padding: none; - } - - tr { - background-color: inherit !important; - } -} - -.ref-table-popover { - padding: 5px 10px; - border-radius: 4px; - font-size: 12px; - box-shadow: hsl(206 22% 7% / 35%) 0px 10px 38px -10px, - hsl(206 22% 7% / 20%) 0px 10px 20px -15px; - animation-duration: 400ms; - animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); - will-change: transform, opacity; - background-color: var(--ifm-background-surface-color); - color: var(--ifm-font-color-base); -} diff --git a/packages/docs/src/components/ui/referenceTable.tsx b/packages/docs/src/components/ui/referenceTable.tsx deleted file mode 100644 index 8ee4b31b8..000000000 --- a/packages/docs/src/components/ui/referenceTable.tsx +++ /dev/null @@ -1,196 +0,0 @@ -import * as React from 'react'; -import './referenceTable.scss'; - -export interface ReferenceProps { - title?: string; - url?: string; - data: { - property: string; - propertyDescription?: string; - default?: string; - type: string; - typeDescription?: string; - }[]; -} - -import * as Popover from '@radix-ui/react-popover'; -import { InfoCircledIcon } from '@radix-ui/react-icons'; - -export const ReactPropDocsTable = (props: ReferenceProps) => { - return ( -
-
- {props.title && {props.title}} - {props.url && ( - - )} -
- - - - - - - - - - {props.data.map((item) => { - return ( - - - - - - ); - })} - -
PropertyTypeDefault
- - {item.property} - {item.propertyDescription && ( - - - - - - -
- { - item.propertyDescription - } -
-
-
-
- )} -
-
- - {item.type} - {item.typeDescription && ( - - - - - - -
- - { - item.typeDescription - } - -
-
-
-
- )} -
-
- {item.default ? ( - {item.default} - ) : ( - {'-'} - )} -
-
- ); -}; - -export const ClassDocsTable = (props: ReferenceProps) => { - return ( -
-
{props.title && {props.title}}
- - - - - - - - - - {props.data.map((item) => { - return ( - - - - - - ); - })} - -
PropertyTypeDefault
- - {item.property} - {item.propertyDescription && ( - - - - - - -
- { - item.propertyDescription - } -
-
-
-
- )} -
-
- - {item.type} - {item.typeDescription && ( - - - - - - -
- - { - item.typeDescription - } - -
-
-
-
- )} -
-
- {item.default ? ( - {item.default} - ) : ( - {'-'} - )} -
-
- ); -}; diff --git a/packages/docs/src/generated/api.output.json b/packages/docs/src/generated/api.output.json index e922f24ac..4c3fdca77 100644 --- a/packages/docs/src/generated/api.output.json +++ b/packages/docs/src/generated/api.output.json @@ -3,195 +3,539 @@ { "name": "activeGroup", "signature": "DockviewGroupPanel | undefined", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Active group object." + } + ] + }, "type": "accessor" }, { "name": "activePanel", "signature": "IDockviewPanel | undefined", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Active panel object." + } + ] + }, "type": "accessor" }, { "name": "groups", "signature": "DockviewGroupPanel[]", + "comment": { + "summary": [ + { + "kind": "text", + "text": "All group objects." + } + ] + }, "type": "accessor" }, { "name": "height", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Height of the component." + } + ] + }, "type": "accessor" }, { "name": "id", "signature": "string", + "comment": { + "summary": [ + { + "kind": "text", + "text": "The unique identifier for this instance. Used to manage scope of Drag'n'Drop events." + } + ] + }, "type": "accessor" }, { "name": "maximumHeight", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Maximum height of the component." + } + ] + }, "type": "accessor" }, { "name": "maximumWidth", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Maximum width of the component." + } + ] + }, "type": "accessor" }, { "name": "minimumHeight", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Minimum height of the component." + } + ] + }, "type": "accessor" }, { "name": "minimumWidth", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Minimum width of the component." + } + ] + }, "type": "accessor" }, { "name": "onDidActiveGroupChange", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when the active group changes. May be undefined if no group is active." + } + ] + }, "type": "accessor" }, { "name": "onDidActivePanelChange", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when the active panel changes. May be undefined if no panel is active." + } + ] + }, "type": "accessor" }, { "name": "onDidAddGroup", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when a group is added. May be called multiple times when moving groups." + } + ] + }, "type": "accessor" }, { "name": "onDidAddPanel", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when a panel is added. May be called multiple times when moving panels." + } + ] + }, "type": "accessor" }, { "name": "onDidDrop", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when a Drag'n'Drop event occurs that the component was unable to handle. Exposed for custom Drag'n'Drop functionality." + } + ] + }, "type": "accessor" }, { "name": "onDidLayoutChange", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when any layout change occures, an aggregation of many events." + } + ] + }, "type": "accessor" }, { "name": "onDidLayoutFromJSON", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked after a layout is deserialzied using the " + }, + { + "kind": "code", + "text": "`fromJSON`" + }, + { + "kind": "text", + "text": " method." + } + ] + }, "type": "accessor" }, { "name": "onDidRemoveGroup", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when a group is removed. May be called multiple times when moving groups." + } + ] + }, "type": "accessor" }, { "name": "onDidRemovePanel", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when a panel is removed. May be called multiple times when moving panels." + } + ] + }, "type": "accessor" }, { "name": "onWillDragGroup", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked before a group is dragged. Exposed for custom Drag'n'Drop functionality." + } + ] + }, "type": "accessor" }, { "name": "onWillDragPanel", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked before a panel is dragged. Exposed for custom Drag'n'Drop functionality." + } + ] + }, "type": "accessor" }, { "name": "panels", "signature": "IDockviewPanel[]", + "comment": { + "summary": [ + { + "kind": "text", + "text": "All panel objects." + } + ] + }, "type": "accessor" }, { "name": "size", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Total number of groups." + } + ] + }, "type": "accessor" }, { "name": "totalPanels", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Total number of panels." + } + ] + }, "type": "accessor" }, { "name": "width", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Width of the component." + } + ] + }, "type": "accessor" }, { "name": "addFloatingGroup", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Add a floating group" + } + ] + }, "signature": "(item: IDockviewPanel | DockviewGroupPanel, coord?: { x: number, y: number }): void", "type": "method" }, { "name": "addGroup", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Add a group and return the created object." + } + ] + }, "signature": "(options?: AddGroupOptions): DockviewGroupPanel", "type": "method" }, { "name": "addPanel", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Add a panel and return the created object." + } + ] + }, "signature": "(options: AddPanelOptions): IDockviewPanel", "type": "method" }, { "name": "clear", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Reset the component back to an empty and default state." + } + ] + }, "signature": "(): void", "type": "method" }, { "name": "closeAllGroups", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Close all groups and panels." + } + ] + }, "signature": "(): void", "type": "method" }, { "name": "focus", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Focus the component. Will try to focus an active panel if one exists." + } + ] + }, "signature": "(): void", "type": "method" }, { "name": "fromJSON", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Create a component from a serialized object." + } + ] + }, "signature": "(data: SerializedDockview): void", "type": "method" }, { "name": "getGroup", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Get a group object given a " + }, + { + "kind": "code", + "text": "`string`" + }, + { + "kind": "text", + "text": " id. May return undefined." + } + ] + }, "signature": "(id: string): DockviewGroupPanel | undefined", "type": "method" }, { "name": "getPanel", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Get a panel object given a " + }, + { + "kind": "code", + "text": "`string`" + }, + { + "kind": "text", + "text": " id. May return " + }, + { + "kind": "code", + "text": "`undefined`" + }, + { + "kind": "text", + "text": "." + } + ] + }, "signature": "(id: string): IDockviewPanel | undefined", "type": "method" }, { "name": "layout", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Force resize the component to an exact width and height. Read about auto-resizing before using." + } + ] + }, "signature": "(width: number, height: number, force: boolean = false): void", "type": "method" }, { "name": "moveToNext", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Move the focus progmatically to the next panel or group." + } + ] + }, "signature": "(options?: MovementOptions): void", "type": "method" }, { "name": "moveToPrevious", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Move the focus progmatically to the previous panel or group." + } + ] + }, "signature": "(options?: MovementOptions): void", "type": "method" }, { "name": "removeGroup", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Remove a group and any panels within the group." + } + ] + }, "signature": "(group: IDockviewGroupPanel): void", "type": "method" }, { "name": "removePanel", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Remove a panel given the panel object." + } + ] + }, "signature": "(panel: IDockviewPanel): void", "type": "method" }, { "name": "toJSON", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Create a serialized object of the current component." + } + ] + }, "signature": "(): SerializedDockview", "type": "method" } @@ -200,110 +544,310 @@ { "name": "height", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Height of the component." + } + ] + }, "type": "accessor" }, { "name": "maximumHeight", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Maximum height of the component." + } + ] + }, "type": "accessor" }, { "name": "maximumWidth", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Maximum width of the component." + } + ] + }, "type": "accessor" }, { "name": "minimumHeight", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Minimum height of the component." + } + ] + }, "type": "accessor" }, { "name": "minimumWidth", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Minimum width of the component." + } + ] + }, "type": "accessor" }, { "name": "onDidActivePanelChange", "signature": "Event | undefined>", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when the active panel changes. May be undefined if no panel is active." + } + ] + }, "type": "accessor" }, { "name": "onDidAddPanel", "signature": "Event>", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when a panel is added. May be called multiple times when moving panels." + } + ] + }, "type": "accessor" }, { "name": "onDidLayoutChange", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when any layout change occures, an aggregation of many events." + } + ] + }, "type": "accessor" }, { "name": "onDidLayoutFromJSON", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked after a layout is deserialzied using the " + }, + { + "kind": "code", + "text": "`fromJSON`" + }, + { + "kind": "text", + "text": " method." + } + ] + }, "type": "accessor" }, { "name": "onDidRemovePanel", "signature": "Event>", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when a panel is removed. May be called multiple times when moving panels." + } + ] + }, "type": "accessor" }, { "name": "orientation", "signature": "Orientation", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Current orientation. Can be changed after initialization." + } + ] + }, "type": "accessor" }, { "name": "panels", "signature": "IGridviewPanel[]", + "comment": { + "summary": [ + { + "kind": "text", + "text": "All panel objects." + } + ] + }, "type": "accessor" }, { "name": "width", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Width of the component." + } + ] + }, "type": "accessor" }, { "name": "addPanel", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Add a panel and return the created object." + } + ] + }, "signature": "(options: AddComponentOptions): IGridviewPanel", "type": "method" }, { "name": "clear", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Reset the component back to an empty and default state." + } + ] + }, "signature": "(): void", "type": "method" }, { "name": "focus", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Focus the component. Will try to focus an active panel if one exists." + } + ] + }, "signature": "(): void", "type": "method" }, { "name": "fromJSON", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Create a component from a serialized object." + } + ] + }, "signature": "(data: SerializedGridviewComponent): void", "type": "method" }, { "name": "getPanel", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Get a panel object given a " + }, + { + "kind": "code", + "text": "`string`" + }, + { + "kind": "text", + "text": " id. May return " + }, + { + "kind": "code", + "text": "`undefined`" + }, + { + "kind": "text", + "text": "." + } + ] + }, "signature": "(id: string): IGridviewPanel | undefined", "type": "method" }, { "name": "layout", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Force resize the component to an exact width and height. Read about auto-resizing before using." + } + ] + }, "signature": "(width: number, height: number, force: boolean = false): void", "type": "method" }, { "name": "movePanel", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Move a panel in a particular direction relative to another panel." + } + ] + }, "signature": "(panel: IGridviewPanel, options: { direction: Direction, reference: string, size: number }): void", "type": "method" }, { "name": "removePanel", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Remove a panel given the panel object." + } + ] + }, "signature": "(panel: IGridviewPanel, sizing?: Sizing): void", "type": "method" }, { "name": "toJSON", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Create a serialized object of the current component." + } + ] + }, "signature": "(): SerializedGridviewComponent", "type": "method" } @@ -312,95 +856,271 @@ { "name": "height", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Height of the component." + } + ] + }, "type": "accessor" }, { "name": "maximumSize", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "The maximum size the component can reach where size is measured in the direction of orientation provided." + } + ] + }, "type": "accessor" }, { "name": "minimumSize", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "The minimum size the component can reach where size is measured in the direction of orientation provided." + } + ] + }, "type": "accessor" }, { "name": "onDidAddView", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when a panel is added. May be called multiple times when moving panels." + } + ] + }, "type": "accessor" }, { "name": "onDidDrop", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when a Drag'n'Drop event occurs that the component was unable to handle. Exposed for custom Drag'n'Drop functionality." + } + ] + }, "type": "accessor" }, { "name": "onDidLayoutChange", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when any layout change occures, an aggregation of many events." + } + ] + }, "type": "accessor" }, { "name": "onDidLayoutFromJSON", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked after a layout is deserialzied using the " + }, + { + "kind": "code", + "text": "`fromJSON`" + }, + { + "kind": "text", + "text": " method." + } + ] + }, "type": "accessor" }, { "name": "onDidRemoveView", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when a panel is removed. May be called multiple times when moving panels." + } + ] + }, "type": "accessor" }, { "name": "panels", "signature": "IPaneviewPanel[]", + "comment": { + "summary": [ + { + "kind": "text", + "text": "All panel objects." + } + ] + }, "type": "accessor" }, { "name": "width", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Width of the component." + } + ] + }, "type": "accessor" }, { "name": "addPanel", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Add a panel and return the created object." + } + ] + }, "signature": "(options: AddPaneviewComponentOptions): IPaneviewPanel", "type": "method" }, { "name": "clear", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Reset the component back to an empty and default state." + } + ] + }, "signature": "(): void", "type": "method" }, { "name": "focus", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Focus the component. Will try to focus an active panel if one exists." + } + ] + }, "signature": "(): void", "type": "method" }, { "name": "fromJSON", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Create a component from a serialized object." + } + ] + }, "signature": "(data: SerializedPaneview): void", "type": "method" }, { "name": "getPanel", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Get a panel object given a " + }, + { + "kind": "code", + "text": "`string`" + }, + { + "kind": "text", + "text": " id. May return " + }, + { + "kind": "code", + "text": "`undefined`" + }, + { + "kind": "text", + "text": "." + } + ] + }, "signature": "(id: string): IPaneviewPanel | undefined", "type": "method" }, { "name": "layout", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Force resize the component to an exact width and height. Read about auto-resizing before using." + } + ] + }, "signature": "(width: number, height: number): void", "type": "method" }, { "name": "movePanel", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Move a panel given it's current and desired index." + } + ] + }, "signature": "(from: number, to: number): void", "type": "method" }, { "name": "removePanel", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Remove a panel given the panel object." + } + ] + }, "signature": "(panel: IPaneviewPanel): void", "type": "method" }, { "name": "toJSON", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Create a serialized object of the current component." + } + ] + }, "signature": "(): SerializedPaneview", "type": "method" } @@ -409,105 +1129,297 @@ { "name": "height", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Height of the component." + } + ] + }, "type": "accessor" }, { "name": "length", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "The current number of panels." + } + ] + }, "type": "accessor" }, { "name": "maximumSize", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "The maximum size the component can reach where size is measured in the direction of orientation provided." + } + ] + }, "type": "accessor" }, { "name": "minimumSize", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "The minimum size the component can reach where size is measured in the direction of orientation provided." + } + ] + }, "type": "accessor" }, { "name": "onDidAddView", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when a view is added." + } + ] + }, "type": "accessor" }, { "name": "onDidLayoutChange", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked whenever any aspect of the layout changes.\nIf listening to this event it may be worth debouncing ouputs." + } + ] + }, "type": "accessor" }, { "name": "onDidLayoutFromJSON", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked after a layout is loaded through the " + }, + { + "kind": "code", + "text": "`fromJSON`" + }, + { + "kind": "text", + "text": " method." + } + ] + }, "type": "accessor" }, { "name": "onDidRemoveView", "signature": "Event", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Invoked when a view is removed." + } + ] + }, "type": "accessor" }, { "name": "orientation", "signature": "Orientation", + "comment": { + "summary": [ + { + "kind": "text", + "text": "The current orientation of the component." + } + ] + }, "type": "accessor" }, { "name": "panels", "signature": "ISplitviewPanel[]", + "comment": { + "summary": [ + { + "kind": "text", + "text": "The list of current panels." + } + ] + }, "type": "accessor" }, { "name": "width", "signature": "number", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Width of the component." + } + ] + }, "type": "accessor" }, { "name": "addPanel", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Add a new panel and return the created instance." + } + ] + }, "signature": "(options: AddSplitviewComponentOptions): ISplitviewPanel", "type": "method" }, { "name": "clear", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Remove all panels and clear the component." + } + ] + }, "signature": "(): void", "type": "method" }, { "name": "focus", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Focus the component." + } + ] + }, "signature": "(): void", "type": "method" }, { "name": "fromJSON", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Deserialize a layout to built a splitivew." + } + ] + }, "signature": "(data: SerializedSplitview): void", "type": "method" }, { "name": "getPanel", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Get the reference to a panel given it's " + }, + { + "kind": "code", + "text": "`string`" + }, + { + "kind": "text", + "text": " id." + } + ] + }, "signature": "(id: string): ISplitviewPanel | undefined", "type": "method" }, { "name": "layout", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Layout the panel with a width and height." + } + ] + }, "signature": "(width: number, height: number): void", "type": "method" }, { "name": "movePanel", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Move a panel given it's current and desired index." + } + ] + }, "signature": "(from: number, to: number): void", "type": "method" }, { "name": "removePanel", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Removes an existing panel and optionally provide a " + }, + { + "kind": "code", + "text": "`Sizing`" + }, + { + "kind": "text", + "text": " method\nfor the subsequent resize." + } + ] + }, "signature": "(panel: ISplitviewPanel, sizing?: Sizing): void", "type": "method" }, { "name": "toJSON", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Serialize a layout" + } + ] + }, "signature": "(): SerializedSplitview", "type": "method" }, { "name": "updateOptions", + "comment": { + "summary": [ + { + "kind": "text", + "text": "Update configuratable options." + } + ] + }, "signature": "(options: SplitviewComponentUpdateOptions): void", "type": "method" } @@ -1133,6 +2045,11 @@ "signature": "(event: DockviewReadyEvent): void", "type": "property" }, + { + "name": "prefixHeaderActionsComponent", + "signature": "FunctionComponent", + "type": "property" + }, { "name": "rightHeaderActionsComponent", "signature": "FunctionComponent", diff --git a/packages/docs/versioned_docs/version-1.8.4/components/dockview.mdx b/packages/docs/versioned_docs/version-1.8.4/components/dockview.mdx index 9c9ac1ed9..6c9528f88 100644 --- a/packages/docs/versioned_docs/version-1.8.4/components/dockview.mdx +++ b/packages/docs/versioned_docs/version-1.8.4/components/dockview.mdx @@ -27,7 +27,6 @@ import DockviewTabheight from '@site/sandboxes/tabheight-dockview/src/app'; import DockviewWithIFrames from '@site/sandboxes/iframe-dockview/src/app'; import DockviewFloating from '@site/sandboxes/floatinggroup-dockview/src/app'; import DockviewLockedGroup from '@site/sandboxes/lockedgroup-dockview/src/app'; -import IDEExample from '@site/sandboxes/ide-example/src/app'; import DockviewKeyboard from '@site/sandboxes/keyboard-dockview/src/app'; import { DocRef, Markdown } from '@site/src/components/ui/reference/docRef'; @@ -862,14 +861,6 @@ Keyboard shortcuts react={DockviewKeyboard} /> -## Application with sidebars - - - ### Nested Dockviews You can safely create multiple dockview instances within one page and nest dockviews within other dockviews. diff --git a/scripts/docs.mjs b/scripts/docs.mjs index bf940e8ab..05003fbfd 100644 --- a/scripts/docs.mjs +++ b/scripts/docs.mjs @@ -288,11 +288,12 @@ function getFunction( }; } case ReflectionKind.Method: { - const { signatures, comment } = method; + const { signatures } = method; if (signatures.length > 1) { throw new Error(`signatures.length > 1`); } - const { name, parameters, type, typeParameter } = signatures[0]; + const { name, parameters, type, typeParameter, comment } = + signatures[0]; let _typeParameter = '';