mirror of
https://github.com/mathuo/dockview
synced 2025-05-03 10:08:24 +00:00
refactor: housekeeping
This commit is contained in:
parent
09c639c28f
commit
2631765972
@ -1,14 +1,18 @@
|
||||
const DOCKVIEW_SUPPRESS_WATERMARK = 'DOCKVIEW_WATERMARK_SUPPRESSED';
|
||||
function runFootnote() {
|
||||
const DOCKVIEW_SUPPRESS_WATERMARK = 'DOCKVIEW_WATERMARK_SUPPRESSED';
|
||||
|
||||
const isSuppressed = !!(window as any)[DOCKVIEW_SUPPRESS_WATERMARK];
|
||||
const isSuppressed = !!(window as any)[DOCKVIEW_SUPPRESS_WATERMARK];
|
||||
|
||||
if (!isSuppressed) {
|
||||
console.log(
|
||||
[
|
||||
'dockview: https://github.com/mathuo/dockview for examples and documentation',
|
||||
'dockview: https://www.npmjs.com/package/dockview',
|
||||
`dockview: To suppress this message set window.${DOCKVIEW_SUPPRESS_WATERMARK}=1 before importing the dockview package`,
|
||||
'',
|
||||
].join('\n')
|
||||
);
|
||||
if (!isSuppressed) {
|
||||
console.log(
|
||||
[
|
||||
'dockview: https://github.com/mathuo/dockview for examples and documentation',
|
||||
'dockview: https://www.npmjs.com/package/dockview',
|
||||
`dockview: To suppress this message set window.${DOCKVIEW_SUPPRESS_WATERMARK}=1 before importing the dockview package`,
|
||||
'',
|
||||
].join('\n')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
runFootnote();
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
import { ReactPartContext } from '../react';
|
||||
import { isReactElement, ReactPartContext } from '../react';
|
||||
import { ReactContentPartContext } from './reactContentPart';
|
||||
|
||||
interface WithChildren {
|
||||
@ -18,13 +18,6 @@ const Action: React.FunctionComponent<WithChildren> = (props: WithChildren) => {
|
||||
return <>{props.children}</>;
|
||||
};
|
||||
|
||||
// it does the job...
|
||||
function isReactElement(
|
||||
element: any | React.ReactElement
|
||||
): element is React.ReactElement {
|
||||
return !!(element as any)?.type;
|
||||
}
|
||||
|
||||
function isValidComponent(element: React.ReactElement) {
|
||||
return [Body, Action, Tab].find((comp) => element.type === comp);
|
||||
}
|
||||
|
@ -16,10 +16,6 @@ import { IDisposable } from '../../lifecycle';
|
||||
import { watchElementResize } from '../../dom';
|
||||
import { IContentRenderer, ITabRenderer } from '../../groupview/types';
|
||||
|
||||
export interface ActionsbarReference<P> extends IDisposable {
|
||||
update(params: Partial<P>): void;
|
||||
}
|
||||
|
||||
export interface IGroupPanelBaseProps {
|
||||
api: IDockviewPanelApi;
|
||||
containerApi: DockviewApi;
|
||||
|
@ -5,9 +5,9 @@ import {
|
||||
GroupPanelContentPartInitParameters,
|
||||
} from '../../groupview/types';
|
||||
import { ReactPart, ReactPortalStore } from '../react';
|
||||
import { ActionsbarReference, IDockviewPanelProps } from '../dockview/dockview';
|
||||
import { IDockviewPanelProps } from '../dockview/dockview';
|
||||
import { PanelUpdateEvent } from '../../panel/types';
|
||||
import { DockviewPanelApi, IDockviewPanelApi } from '../../api/groupPanelApi';
|
||||
import { IDockviewPanelApi } from '../../api/groupPanelApi';
|
||||
import { DockviewApi } from '../../api/component.api';
|
||||
import { HostedContainer } from '../../hostedContainer';
|
||||
import { GroupviewPanel } from '../../groupview/v2/groupviewPanel';
|
||||
|
@ -58,7 +58,7 @@ const ReactComponentBridge: React.ForwardRefRenderFunction<
|
||||
|
||||
return React.createElement(props.component, _props.current);
|
||||
};
|
||||
ReactComponentBridge.displayName = 'PanelWrapper';
|
||||
ReactComponentBridge.displayName = 'DockviewReactJsBridge';
|
||||
|
||||
/**
|
||||
* Since we are storing the React.Portal references in a rendered array they
|
||||
@ -181,3 +181,10 @@ export const usePortalsLifecycle: PortalLifecycleHook = () => {
|
||||
|
||||
return [portals, addPortal];
|
||||
};
|
||||
|
||||
// it does the job...
|
||||
export function isReactElement(
|
||||
element: any | React.ReactElement
|
||||
): element is React.ReactElement {
|
||||
return !!(element as any)?.type;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user