@vuu-ui/vuu-layout 0.5.15 → 0.5.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/cjs/index.js +20 -0
- package/cjs/index.js.map +7 -0
- package/esm/index.js +20 -0
- package/esm/index.js.map +7 -0
- package/index.css +2 -0
- package/index.css.map +7 -0
- package/package.json +16 -10
- package/types/Component.d.ts +7 -0
- package/types/DraggableLayout.d.ts +6 -0
- package/types/chest-of-drawers/Chest.d.ts +10 -0
- package/types/chest-of-drawers/Drawer.d.ts +18 -0
- package/{src/chest-of-drawers/index.ts → types/chest-of-drawers/index.d.ts} +0 -0
- package/types/common-types.d.ts +8 -0
- package/types/debug.d.ts +2 -0
- package/types/drag-drop/BoxModel.d.ts +143 -0
- package/types/drag-drop/DragState.d.ts +46 -0
- package/types/drag-drop/Draggable.d.ts +23 -0
- package/types/drag-drop/DropMenu.d.ts +10 -0
- package/types/drag-drop/DropTarget.d.ts +61 -0
- package/types/drag-drop/DropTargetRenderer.d.ts +18 -0
- package/types/drag-drop/dragDropTypes.d.ts +51 -0
- package/{src/drag-drop/index.ts → types/drag-drop/index.d.ts} +0 -1
- package/types/editable-label/EditableLabel.d.ts +9 -0
- package/{src/editable-label/index.ts → types/editable-label/index.d.ts} +0 -0
- package/types/flexbox/Flexbox.d.ts +5 -0
- package/types/flexbox/FlexboxLayout.d.ts +6 -0
- package/types/flexbox/FluidGrid.d.ts +7 -0
- package/types/flexbox/FluidGridLayout.d.ts +6 -0
- package/types/flexbox/Splitter.d.ts +13 -0
- package/types/flexbox/flexbox-utils.d.ts +12 -0
- package/types/flexbox/flexboxTypes.d.ts +51 -0
- package/{src/flexbox/index.ts → types/flexbox/index.d.ts} +0 -1
- package/types/flexbox/useResponsiveSizing.d.ts +10 -0
- package/types/flexbox/useSplitterResizing.d.ts +2 -0
- package/{src/index.ts → types/index.d.ts} +0 -1
- package/types/layout-action.d.ts +21 -0
- package/types/layout-header/ActionButton.d.ts +8 -0
- package/types/layout-header/Header.d.ts +13 -0
- package/{src/layout-header/index.ts → types/layout-header/index.d.ts} +0 -0
- package/types/layout-provider/LayoutProvider.d.ts +14 -0
- package/types/layout-provider/LayoutProviderContext.d.ts +8 -0
- package/{src/layout-provider/index.ts → types/layout-provider/index.d.ts} +0 -1
- package/types/layout-provider/useLayoutDragDrop.d.ts +4 -0
- package/types/layout-reducer/flexUtils.d.ts +22 -0
- package/{src/layout-reducer/index.ts → types/layout-reducer/index.d.ts} +0 -1
- package/types/layout-reducer/insert-layout-element.d.ts +8 -0
- package/types/layout-reducer/layout-reducer.d.ts +3 -0
- package/types/layout-reducer/layoutTypes.d.ts +130 -0
- package/types/layout-reducer/layoutUtils.d.ts +28 -0
- package/types/layout-reducer/remove-layout-element.d.ts +3 -0
- package/types/layout-reducer/replace-layout-element.d.ts +6 -0
- package/types/layout-reducer/resize-flex-children.d.ts +3 -0
- package/types/layout-reducer/wrap-layout-element.d.ts +9 -0
- package/types/layout-view/View.d.ts +5 -0
- package/types/layout-view/ViewContext.d.ts +18 -0
- package/{src/layout-view/index.ts → types/layout-view/index.d.ts} +0 -1
- package/types/layout-view/useView.d.ts +21 -0
- package/types/layout-view/useViewActionDispatcher.d.ts +8 -0
- package/types/layout-view/useViewResize.d.ts +7 -0
- package/types/layout-view/viewTypes.d.ts +18 -0
- package/types/palette/Palette.d.ts +18 -0
- package/types/palette/PaletteSalt.d.ts +14 -0
- package/{src/palette/index.ts → types/palette/index.d.ts} +0 -1
- package/types/placeholder/Placeholder.d.ts +12 -0
- package/{src/placeholder/index.ts → types/placeholder/index.d.ts} +0 -0
- package/types/registry/ComponentRegistry.d.ts +14 -0
- package/{src/registry/index.ts → types/registry/index.d.ts} +0 -0
- package/types/responsive/breakpoints.d.ts +4 -0
- package/{src/responsive/index.ts → types/responsive/index.d.ts} +0 -0
- package/types/responsive/measureMinimumNodeSize.d.ts +1 -0
- package/types/responsive/overflowUtils.d.ts +2 -0
- package/types/responsive/use-breakpoints.d.ts +7 -0
- package/types/responsive/useResizeObserver.d.ts +12 -0
- package/types/responsive/utils.d.ts +6 -0
- package/types/stack/Stack.d.ts +4 -0
- package/types/stack/StackLayout.d.ts +7 -0
- package/{src/stack/index.ts → types/stack/index.d.ts} +0 -1
- package/types/stack/stackTypes.d.ts +20 -0
- package/types/tabs/TabPanel.d.ts +7 -0
- package/{src/tabs/index.ts → types/tabs/index.d.ts} +0 -0
- package/types/tools/config-wrapper/ConfigWrapper.d.ts +2 -0
- package/{src/tools/config-wrapper/index.ts → types/tools/config-wrapper/index.d.ts} +0 -0
- package/types/tools/devtools-box/layout-configurator.d.ts +31 -0
- package/types/tools/devtools-tree/layout-tree-viewer.d.ts +5 -0
- package/{src/tools/index.ts → types/tools/index.d.ts} +0 -1
- package/types/use-persistent-state.d.ts +11 -0
- package/{src/utils/index.ts → types/utils/index.d.ts} +0 -0
- package/types/utils/pathUtils.d.ts +18 -0
- package/types/utils/propUtils.d.ts +5 -0
- package/types/utils/refUtils.d.ts +2 -0
- package/types/utils/styleUtils.d.ts +3 -0
- package/types/utils/typeOf.d.ts +4 -0
- package/src/Component.css +0 -0
- package/src/Component.tsx +0 -20
- package/src/DraggableLayout.css +0 -18
- package/src/DraggableLayout.tsx +0 -26
- package/src/__tests__/flexbox-utils.spec.js +0 -90
- package/src/chest-of-drawers/Chest.css +0 -36
- package/src/chest-of-drawers/Chest.tsx +0 -42
- package/src/chest-of-drawers/Drawer.css +0 -159
- package/src/chest-of-drawers/Drawer.tsx +0 -118
- package/src/common-types.ts +0 -9
- package/src/debug.ts +0 -16
- package/src/drag-drop/BoxModel.ts +0 -551
- package/src/drag-drop/DragState.ts +0 -219
- package/src/drag-drop/Draggable.ts +0 -282
- package/src/drag-drop/DropMenu.css +0 -71
- package/src/drag-drop/DropMenu.tsx +0 -61
- package/src/drag-drop/DropTarget.ts +0 -393
- package/src/drag-drop/DropTargetRenderer.css +0 -40
- package/src/drag-drop/DropTargetRenderer.tsx +0 -277
- package/src/drag-drop/dragDropTypes.ts +0 -47
- package/src/editable-label/EditableLabel.css +0 -28
- package/src/editable-label/EditableLabel.tsx +0 -99
- package/src/flexbox/Flexbox.css +0 -45
- package/src/flexbox/Flexbox.tsx +0 -70
- package/src/flexbox/FlexboxLayout.tsx +0 -28
- package/src/flexbox/FluidGrid.css +0 -134
- package/src/flexbox/FluidGrid.tsx +0 -82
- package/src/flexbox/FluidGridLayout.tsx +0 -9
- package/src/flexbox/Splitter.css +0 -140
- package/src/flexbox/Splitter.tsx +0 -127
- package/src/flexbox/flexbox-utils.ts +0 -128
- package/src/flexbox/flexboxTypes.ts +0 -68
- package/src/flexbox/useResponsiveSizing.ts +0 -82
- package/src/flexbox/useSplitterResizing.ts +0 -270
- package/src/layout-action.ts +0 -21
- package/src/layout-header/ActionButton.tsx +0 -23
- package/src/layout-header/Header.css +0 -8
- package/src/layout-header/Header.tsx +0 -216
- package/src/layout-provider/LayoutProvider.tsx +0 -161
- package/src/layout-provider/LayoutProviderContext.ts +0 -17
- package/src/layout-provider/useLayoutDragDrop.ts +0 -210
- package/src/layout-reducer/flexUtils.ts +0 -276
- package/src/layout-reducer/insert-layout-element.ts +0 -365
- package/src/layout-reducer/layout-reducer.ts +0 -237
- package/src/layout-reducer/layoutTypes.ts +0 -159
- package/src/layout-reducer/layoutUtils.ts +0 -288
- package/src/layout-reducer/remove-layout-element.ts +0 -226
- package/src/layout-reducer/replace-layout-element.ts +0 -113
- package/src/layout-reducer/resize-flex-children.ts +0 -55
- package/src/layout-reducer/wrap-layout-element.ts +0 -307
- package/src/layout-view/View.css +0 -61
- package/src/layout-view/View.tsx +0 -143
- package/src/layout-view/ViewContext.ts +0 -30
- package/src/layout-view/useView.tsx +0 -104
- package/src/layout-view/useViewActionDispatcher.ts +0 -123
- package/src/layout-view/useViewResize.ts +0 -53
- package/src/layout-view/viewTypes.ts +0 -35
- package/src/palette/Palette.css +0 -33
- package/src/palette/Palette.tsx +0 -140
- package/src/palette/PaletteSalt.css +0 -9
- package/src/palette/PaletteSalt.tsx +0 -79
- package/src/placeholder/Placeholder.css +0 -10
- package/src/placeholder/Placeholder.tsx +0 -38
- package/src/registry/ComponentRegistry.ts +0 -44
- package/src/responsive/breakpoints.ts +0 -62
- package/src/responsive/measureMinimumNodeSize.ts +0 -23
- package/src/responsive/overflowUtils.js +0 -14
- package/src/responsive/use-breakpoints.ts +0 -101
- package/src/responsive/useResizeObserver.ts +0 -154
- package/src/responsive/utils.ts +0 -37
- package/src/stack/Stack.css +0 -39
- package/src/stack/Stack.tsx +0 -173
- package/src/stack/StackLayout.tsx +0 -119
- package/src/stack/stackTypes.ts +0 -22
- package/src/tabs/TabPanel.css +0 -12
- package/src/tabs/TabPanel.tsx +0 -17
- package/src/tools/config-wrapper/ConfigWrapper.tsx +0 -55
- package/src/tools/devtools-box/layout-configurator.css +0 -112
- package/src/tools/devtools-box/layout-configurator.jsx +0 -369
- package/src/tools/devtools-tree/layout-tree-viewer.css +0 -15
- package/src/tools/devtools-tree/layout-tree-viewer.jsx +0 -36
- package/src/use-persistent-state.ts +0 -112
- package/src/utils/pathUtils.ts +0 -283
- package/src/utils/propUtils.ts +0 -26
- package/src/utils/refUtils.ts +0 -16
- package/src/utils/styleUtils.ts +0 -13
- package/src/utils/typeOf.ts +0 -25
- package/tsconfig-emit-types.json +0 -11
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CSSProperties, HTMLAttributes, MutableRefObject, ReactElement, ReactNode } from "react";
|
|
2
|
+
import { SplitterProps } from "./Splitter";
|
|
3
|
+
export interface LayoutContainerProps {
|
|
4
|
+
resizeable?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface FlexboxProps extends LayoutContainerProps, HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
breakPoints?: BreakPointsProp;
|
|
8
|
+
children: ReactElement[];
|
|
9
|
+
cols?: number;
|
|
10
|
+
column?: true;
|
|
11
|
+
fullPage?: number;
|
|
12
|
+
flexFill?: boolean;
|
|
13
|
+
gap?: number;
|
|
14
|
+
onSplitterMoved?: (content: ContentMeta[]) => void;
|
|
15
|
+
row?: true;
|
|
16
|
+
spacing?: number;
|
|
17
|
+
splitterSize?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface FlexboxLayoutProps extends FlexboxProps {
|
|
20
|
+
path: string;
|
|
21
|
+
}
|
|
22
|
+
export interface SplitterHookProps {
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
onSplitterMoved?: (content: ContentMeta[]) => void;
|
|
25
|
+
style?: CSSProperties;
|
|
26
|
+
}
|
|
27
|
+
export interface SplitterHookResult {
|
|
28
|
+
content: ReactElement[];
|
|
29
|
+
rootRef: MutableRefObject<HTMLDivElement | null>;
|
|
30
|
+
}
|
|
31
|
+
export declare type SplitterFactory = (index: number) => ReactElement<SplitterProps>;
|
|
32
|
+
export declare type ContentMeta = {
|
|
33
|
+
currentSize?: number;
|
|
34
|
+
flexOpen?: boolean;
|
|
35
|
+
flexBasis?: number;
|
|
36
|
+
intrinsicSize?: number;
|
|
37
|
+
minSize?: number;
|
|
38
|
+
placeholder?: boolean;
|
|
39
|
+
resizeable?: boolean;
|
|
40
|
+
shim?: boolean;
|
|
41
|
+
splitter?: boolean;
|
|
42
|
+
};
|
|
43
|
+
export declare type FlexSize = {
|
|
44
|
+
size: number;
|
|
45
|
+
minSize: number;
|
|
46
|
+
};
|
|
47
|
+
export declare type BreakPoint = "xs" | "sm" | "md" | "lg" | "xl";
|
|
48
|
+
export declare type BreakPoints = BreakPoint[];
|
|
49
|
+
export declare type BreakPointsProp = {
|
|
50
|
+
[keys in BreakPoint]?: number;
|
|
51
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CSSProperties, ReactElement } from "react";
|
|
2
|
+
export declare const useResponsiveSizing: ({ children: childrenProp, cols: colsProp, style, }: {
|
|
3
|
+
children: ReactElement[];
|
|
4
|
+
cols?: number | undefined;
|
|
5
|
+
style?: CSSProperties | undefined;
|
|
6
|
+
}) => {
|
|
7
|
+
cols: number;
|
|
8
|
+
content: ReactElement<any, string | import("react").JSXElementConstructor<any>>[] | undefined;
|
|
9
|
+
rootRef: import("react").MutableRefObject<null>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const Action: {
|
|
2
|
+
ADD: string;
|
|
3
|
+
BLUR: string;
|
|
4
|
+
BLUR_SPLITTER: string;
|
|
5
|
+
DRAG_START: string;
|
|
6
|
+
DRAG_STARTED: string;
|
|
7
|
+
DRAG_DROP: string;
|
|
8
|
+
FOCUS: string;
|
|
9
|
+
FOCUS_SPLITTER: string;
|
|
10
|
+
INITIALIZE: string;
|
|
11
|
+
MAXIMIZE: string;
|
|
12
|
+
MINIMIZE: string;
|
|
13
|
+
REMOVE: string;
|
|
14
|
+
REPLACE: string;
|
|
15
|
+
RESTORE: string;
|
|
16
|
+
SAVE: string;
|
|
17
|
+
SET_TITLE: string;
|
|
18
|
+
SPLITTER_RESIZE: string;
|
|
19
|
+
SWITCH_TAB: string;
|
|
20
|
+
TEAR_OUT: string;
|
|
21
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HTMLAttributes, MouseEvent } from 'react';
|
|
2
|
+
export interface ActionButtonProps extends Omit<HTMLAttributes<HTMLButtonElement>, 'onClick'> {
|
|
3
|
+
actionId: 'maximize' | 'minimize' | 'restore' | 'tearout';
|
|
4
|
+
iconName?: string;
|
|
5
|
+
onClick: (evt: MouseEvent, actionId: 'maximize' | 'minimize' | 'restore' | 'tearout') => void;
|
|
6
|
+
}
|
|
7
|
+
declare const ActionButton: ({ actionId, className, iconName, onClick, ...props }: ActionButtonProps) => JSX.Element;
|
|
8
|
+
export default ActionButton;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
import { Contribution } from "../layout-view";
|
|
3
|
+
import "./Header.css";
|
|
4
|
+
export interface HeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
collapsed?: boolean;
|
|
6
|
+
contributions?: Contribution[];
|
|
7
|
+
expanded?: boolean;
|
|
8
|
+
closeable?: boolean;
|
|
9
|
+
onEditTitle: (value: string) => void;
|
|
10
|
+
orientation?: "horizontal" | "vertical";
|
|
11
|
+
tearOut?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const Header: ({ className: classNameProp, contributions, collapsed, closeable, onEditTitle, orientation: orientationProp, style, title, }: HeaderProps) => JSX.Element;
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import { LayoutJSON } from "../layout-reducer";
|
|
3
|
+
import { LayoutProviderDispatch } from "./LayoutProviderContext";
|
|
4
|
+
declare type LayoutChangeHandler = (layout: LayoutJSON, source: string) => void;
|
|
5
|
+
export interface LayoutProviderProps {
|
|
6
|
+
children: ReactElement;
|
|
7
|
+
layout?: LayoutJSON;
|
|
8
|
+
onLayoutChange?: LayoutChangeHandler;
|
|
9
|
+
}
|
|
10
|
+
export declare const LayoutProviderVersion: () => JSX.Element;
|
|
11
|
+
export declare const LayoutProvider: (props: LayoutProviderProps) => ReactElement;
|
|
12
|
+
export declare const useLayoutProviderDispatch: () => LayoutProviderDispatch;
|
|
13
|
+
export declare const useLayoutProviderVersion: () => number;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Dispatch } from 'react';
|
|
2
|
+
import { DragStartAction, LayoutReducerAction, SaveAction } from '../layout-reducer';
|
|
3
|
+
export declare type LayoutProviderDispatch = Dispatch<LayoutReducerAction | SaveAction | DragStartAction>;
|
|
4
|
+
export interface LayoutProviderContextProps {
|
|
5
|
+
dispatchLayoutProvider: LayoutProviderDispatch;
|
|
6
|
+
version: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const LayoutProviderContext: import("react").Context<LayoutProviderContextProps>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MutableRefObject, ReactElement } from "react";
|
|
2
|
+
import { DragStartAction } from "../layout-reducer";
|
|
3
|
+
import { LayoutProviderDispatch } from "./LayoutProviderContext";
|
|
4
|
+
export declare const useLayoutDragDrop: (rootLayoutRef: MutableRefObject<ReactElement>, dispatch: LayoutProviderDispatch) => (action: DragStartAction) => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { CSSProperties, ReactElement, ReactNode } from "react";
|
|
2
|
+
import { dimension, rect, rectTuple } from "../common-types";
|
|
3
|
+
import { DropPos } from "../drag-drop/dragDropTypes";
|
|
4
|
+
export declare type flexDirection = "row" | "column";
|
|
5
|
+
declare type contraDimension = dimension;
|
|
6
|
+
declare type flexDimensionTuple = [dimension, contraDimension, flexDirection];
|
|
7
|
+
export declare type position = {
|
|
8
|
+
height?: number;
|
|
9
|
+
width?: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const getFlexDimensions: (flexDirection?: flexDirection) => flexDimensionTuple;
|
|
12
|
+
export declare const getIntrinsicSize: (component: ReactElement) => {
|
|
13
|
+
height?: number | undefined;
|
|
14
|
+
width?: number | undefined;
|
|
15
|
+
} | undefined;
|
|
16
|
+
export declare function getFlexStyle(component: ReactElement, dimension: dimension, pos?: DropPos): any;
|
|
17
|
+
export declare function hasUnboundedFlexStyle(component: ReactElement): boolean;
|
|
18
|
+
export declare function getFlexOrIntrinsicStyle(component: ReactElement, dimension: dimension, pos: position): any;
|
|
19
|
+
export declare function wrapIntrinsicSizeComponentWithFlexbox(component: ReactElement, flexDirection: flexDirection, path: string, clientRect?: rect, dropRect?: rectTuple): React.FunctionComponentElement<any>;
|
|
20
|
+
export declare function createFlexbox(flexDirection: flexDirection, props: any, children: ReactNode, path: string): React.FunctionComponentElement<any>;
|
|
21
|
+
export declare function createPlaceHolder(path: string, size: number, style?: CSSProperties, props?: any): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import { DropPos } from "../drag-drop";
|
|
3
|
+
import { LayoutModel } from "./layoutTypes";
|
|
4
|
+
declare type insertionPosition = "before" | "after";
|
|
5
|
+
export declare function getInsertTabBeforeAfter(stack: LayoutModel, pos: DropPos): any[];
|
|
6
|
+
export declare function insertIntoContainer(container: ReactElement, targetContainer: ReactElement, newComponent: ReactElement): ReactElement;
|
|
7
|
+
export declare function insertBesideChild(container: ReactElement, existingComponent: any, newComponent: any, insertionPosition: insertionPosition, pos?: DropPos, clientRect?: any, dropRect?: any): ReactElement;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import { DragDropRect, DragInstructions } from "../drag-drop";
|
|
3
|
+
import { DropTarget } from "../drag-drop/DropTarget";
|
|
4
|
+
export interface WithProps {
|
|
5
|
+
props?: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface WithType {
|
|
10
|
+
props?: any;
|
|
11
|
+
title?: string;
|
|
12
|
+
type: string;
|
|
13
|
+
}
|
|
14
|
+
export interface LayoutRoot extends WithProps {
|
|
15
|
+
active?: number;
|
|
16
|
+
children?: ReactElement[];
|
|
17
|
+
type: string;
|
|
18
|
+
}
|
|
19
|
+
export interface LayoutJSON extends WithType {
|
|
20
|
+
children?: LayoutJSON[];
|
|
21
|
+
id?: string;
|
|
22
|
+
props?: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
};
|
|
25
|
+
state?: any;
|
|
26
|
+
type: string;
|
|
27
|
+
}
|
|
28
|
+
export interface WithActive {
|
|
29
|
+
active?: number;
|
|
30
|
+
}
|
|
31
|
+
export declare type LayoutModel = LayoutRoot | ReactElement | WithType;
|
|
32
|
+
export declare type layoutType = "Flexbox" | "View" | "DraggableLayout" | "Stack";
|
|
33
|
+
export declare const LayoutActionType: {
|
|
34
|
+
readonly ADD: "add";
|
|
35
|
+
readonly DRAG_START: "drag-start";
|
|
36
|
+
readonly DRAG_DROP: "drag-drop";
|
|
37
|
+
readonly MAXIMIZE: "maximize";
|
|
38
|
+
readonly MINIMIZE: "minimize";
|
|
39
|
+
readonly REMOVE: "remove";
|
|
40
|
+
readonly REPLACE: "replace";
|
|
41
|
+
readonly RESTORE: "restore";
|
|
42
|
+
readonly SAVE: "save";
|
|
43
|
+
readonly SET_TITLE: "set-title";
|
|
44
|
+
readonly SPLITTER_RESIZE: "splitter-resize";
|
|
45
|
+
readonly SWITCH_TAB: "switch-tab";
|
|
46
|
+
readonly TEAROUT: "tearout";
|
|
47
|
+
};
|
|
48
|
+
export declare type AddAction = {
|
|
49
|
+
component: any;
|
|
50
|
+
path: string;
|
|
51
|
+
type: typeof LayoutActionType.ADD;
|
|
52
|
+
};
|
|
53
|
+
export declare type DragDropAction = {
|
|
54
|
+
draggedReactElement: ReactElement;
|
|
55
|
+
dragInstructions: any;
|
|
56
|
+
dropTarget: Partial<DropTarget>;
|
|
57
|
+
type: typeof LayoutActionType.DRAG_DROP;
|
|
58
|
+
};
|
|
59
|
+
export declare type MaximizeAction = {
|
|
60
|
+
path?: string;
|
|
61
|
+
type: typeof LayoutActionType.MAXIMIZE;
|
|
62
|
+
};
|
|
63
|
+
export declare type MinimizeAction = {
|
|
64
|
+
path?: string;
|
|
65
|
+
type: typeof LayoutActionType.MINIMIZE;
|
|
66
|
+
};
|
|
67
|
+
export declare type RemoveAction = {
|
|
68
|
+
path?: string;
|
|
69
|
+
type: typeof LayoutActionType.REMOVE;
|
|
70
|
+
};
|
|
71
|
+
export declare type ReplaceAction = {
|
|
72
|
+
replacement: any;
|
|
73
|
+
target: any;
|
|
74
|
+
type: typeof LayoutActionType.REPLACE;
|
|
75
|
+
};
|
|
76
|
+
export declare type RestoreAction = {
|
|
77
|
+
path?: string;
|
|
78
|
+
type: typeof LayoutActionType.RESTORE;
|
|
79
|
+
};
|
|
80
|
+
export declare type SetTitleAction = {
|
|
81
|
+
path: string;
|
|
82
|
+
title: string;
|
|
83
|
+
type: typeof LayoutActionType.SET_TITLE;
|
|
84
|
+
};
|
|
85
|
+
export declare type SplitterResizeAction = {
|
|
86
|
+
path: string;
|
|
87
|
+
sizes: {
|
|
88
|
+
currentSize: number;
|
|
89
|
+
flexBasis: number;
|
|
90
|
+
}[];
|
|
91
|
+
type: typeof LayoutActionType.SPLITTER_RESIZE;
|
|
92
|
+
};
|
|
93
|
+
export declare type SwitchTabAction = {
|
|
94
|
+
nextIdx: number;
|
|
95
|
+
path: string;
|
|
96
|
+
type: typeof LayoutActionType.SWITCH_TAB;
|
|
97
|
+
};
|
|
98
|
+
export declare type TearoutAction = {
|
|
99
|
+
path?: string;
|
|
100
|
+
type: typeof LayoutActionType.TEAROUT;
|
|
101
|
+
};
|
|
102
|
+
export declare type LayoutReducerAction = AddAction | DragDropAction | MaximizeAction | MinimizeAction | RemoveAction | ReplaceAction | RestoreAction | SetTitleAction | SplitterResizeAction | SwitchTabAction;
|
|
103
|
+
export declare type SaveAction = {
|
|
104
|
+
type: typeof LayoutActionType.SAVE;
|
|
105
|
+
};
|
|
106
|
+
export declare type AddToolbarContributionViewAction = {
|
|
107
|
+
content: ReactElement;
|
|
108
|
+
location: string;
|
|
109
|
+
type: "add-toolbar-contribution";
|
|
110
|
+
};
|
|
111
|
+
export declare type RemoveToolbarContributionViewAction = {
|
|
112
|
+
location: string;
|
|
113
|
+
type: "remove-toolbar-contribution";
|
|
114
|
+
};
|
|
115
|
+
export declare type MousedownViewAction = {
|
|
116
|
+
preDragActivity?: any;
|
|
117
|
+
index?: number;
|
|
118
|
+
type: "mousedown";
|
|
119
|
+
};
|
|
120
|
+
export declare type DragStartAction = {
|
|
121
|
+
payload?: ReactElement;
|
|
122
|
+
dragContainerPath?: string;
|
|
123
|
+
dragElement?: HTMLElement;
|
|
124
|
+
dragRect: DragDropRect;
|
|
125
|
+
dropTargets?: string[];
|
|
126
|
+
evt: MouseEvent;
|
|
127
|
+
instructions?: DragInstructions;
|
|
128
|
+
path: string;
|
|
129
|
+
type: typeof LayoutActionType.DRAG_START;
|
|
130
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { CSSProperties, ReactElement } from "react";
|
|
2
|
+
import { dimension } from "../common-types";
|
|
3
|
+
import { ComponentWithId } from "../registry/ComponentRegistry";
|
|
4
|
+
import { LayoutJSON, LayoutModel, layoutType } from "./layoutTypes";
|
|
5
|
+
export declare const getManagedDimension: (style: CSSProperties) => [dimension, dimension];
|
|
6
|
+
export declare const applyLayoutProps: (component: ReactElement, path?: string) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
7
|
+
export interface LayoutProps extends ComponentWithId {
|
|
8
|
+
active?: number;
|
|
9
|
+
"data-path"?: string;
|
|
10
|
+
children?: ReactElement[];
|
|
11
|
+
column?: any;
|
|
12
|
+
dropTarget?: any;
|
|
13
|
+
key: string;
|
|
14
|
+
layout?: any;
|
|
15
|
+
path?: string;
|
|
16
|
+
resizeable?: boolean;
|
|
17
|
+
style: CSSProperties;
|
|
18
|
+
type?: string;
|
|
19
|
+
version?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare const processLayoutElement: (layoutElement: ReactElement, previousLayout?: ReactElement) => ReactElement;
|
|
22
|
+
export declare const applyLayout: (type: layoutType, props: LayoutProps, previousLayout?: LayoutModel) => LayoutModel;
|
|
23
|
+
export declare function layoutFromJson({ id, type, children, props, state }: LayoutJSON, path: string): ReactElement;
|
|
24
|
+
export declare function layoutToJSON(component: ReactElement): LayoutJSON;
|
|
25
|
+
export declare function componentToJson(component: ReactElement): LayoutJSON;
|
|
26
|
+
export declare function serializeProps(props?: LayoutProps): {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
} | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
import { ReplaceAction } from './layoutTypes';
|
|
3
|
+
import { LayoutProps } from './layoutUtils';
|
|
4
|
+
export declare function replaceChild(model: ReactElement, { target, replacement }: ReplaceAction): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
5
|
+
export declare function _replaceChild(model: ReactElement, child: ReactElement, replacement: ReactElement<LayoutProps>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
6
|
+
export declare function swapChild(model: ReactElement, child: ReactElement, replacement: ReactElement, op?: 'maximize' | 'minimize' | 'restore'): ReactElement;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
import { SplitterResizeAction } from './layoutTypes';
|
|
3
|
+
export declare function resizeFlexChildren(layoutRoot: ReactElement, { path, sizes }: SplitterResizeAction): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import { DropPos } from "../drag-drop/dragDropTypes";
|
|
3
|
+
import { DropTarget } from "../drag-drop/DropTarget";
|
|
4
|
+
export interface LayoutSpec {
|
|
5
|
+
type: "Stack" | "Flexbox";
|
|
6
|
+
flexDirection: "column" | "row";
|
|
7
|
+
showTabs?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function wrap(container: ReactElement, existingComponent: any, newComponent: any, pos: DropPos, clientRect?: DropTarget["clientRect"], dropRect?: DropTarget["dropRect"]): ReactElement;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { SyntheticEvent } from "react";
|
|
2
|
+
import { ViewAction } from "./viewTypes";
|
|
3
|
+
export declare type ViewDispatch = <Action extends ViewAction = ViewAction>(action: Action, evt?: SyntheticEvent) => Promise<boolean | void>;
|
|
4
|
+
export interface ViewContextProps {
|
|
5
|
+
dispatch?: ViewDispatch | null;
|
|
6
|
+
id?: string;
|
|
7
|
+
load?: (key?: string) => unknown;
|
|
8
|
+
loadSession?: (key?: string) => unknown;
|
|
9
|
+
onConfigChange?: (config: unknown) => void;
|
|
10
|
+
path?: string;
|
|
11
|
+
purge?: (key: string) => void;
|
|
12
|
+
save?: (state: unknown, key: string) => void;
|
|
13
|
+
saveSession?: (state: unknown, key: string) => void;
|
|
14
|
+
title?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const ViewContext: React.Context<ViewContextProps>;
|
|
17
|
+
export declare const useViewDispatch: () => ViewDispatch | null;
|
|
18
|
+
export declare const useViewContext: () => ViewContextProps;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
export interface ViewHookProps {
|
|
3
|
+
id: string;
|
|
4
|
+
rootRef: RefObject<HTMLDivElement>;
|
|
5
|
+
path?: string;
|
|
6
|
+
dropTargets?: string[];
|
|
7
|
+
title?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const useView: ({ id, rootRef, path, dropTargets, title: titleProp, }: ViewHookProps) => {
|
|
10
|
+
contributions: import("./useViewActionDispatcher").Contribution[] | undefined;
|
|
11
|
+
dispatchViewAction: import("./ViewContext").ViewDispatch;
|
|
12
|
+
load: (key?: string) => any;
|
|
13
|
+
loadSession: (key?: string) => any;
|
|
14
|
+
onConfigChange: ({ type: key, ...config }: any) => void;
|
|
15
|
+
onEditTitle: (title: string) => void;
|
|
16
|
+
purge: (key: any) => void;
|
|
17
|
+
restoredState: any;
|
|
18
|
+
save: (state: any, key: any) => void;
|
|
19
|
+
saveSession: (state: any, key: any) => void;
|
|
20
|
+
title: any;
|
|
21
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactElement, RefObject } from "react";
|
|
2
|
+
import { ViewDispatch } from "./ViewContext";
|
|
3
|
+
export declare type Contribution = {
|
|
4
|
+
index?: number;
|
|
5
|
+
location?: string;
|
|
6
|
+
content: ReactElement;
|
|
7
|
+
};
|
|
8
|
+
export declare const useViewActionDispatcher: (id: string, root: RefObject<HTMLDivElement>, viewPath?: string, dropTargets?: string[]) => [ViewDispatch, Contribution[] | undefined];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
export interface ViewResizeHookProps {
|
|
3
|
+
mainRef: RefObject<HTMLDivElement>;
|
|
4
|
+
resize?: "defer" | "responsive";
|
|
5
|
+
rootRef: RefObject<HTMLDivElement>;
|
|
6
|
+
}
|
|
7
|
+
export declare const useViewResize: ({ mainRef, resize, rootRef, }: ViewResizeHookProps) => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
import { HeaderProps } from "../layout-header";
|
|
3
|
+
import { AddToolbarContributionViewAction, MaximizeAction, MinimizeAction, MousedownViewAction, RemoveAction, RemoveToolbarContributionViewAction, RestoreAction, TearoutAction } from "../layout-reducer";
|
|
4
|
+
export declare type ViewAction = MaximizeAction | MinimizeAction | MousedownViewAction | RemoveAction | RestoreAction | TearoutAction | AddToolbarContributionViewAction | RemoveToolbarContributionViewAction;
|
|
5
|
+
export interface ViewProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
closeable?: boolean;
|
|
7
|
+
collapsed?: boolean;
|
|
8
|
+
"data-resizeable"?: boolean;
|
|
9
|
+
dropTargets?: string[];
|
|
10
|
+
expanded?: boolean;
|
|
11
|
+
flexFill?: any;
|
|
12
|
+
header?: boolean | Partial<HeaderProps>;
|
|
13
|
+
orientation?: "vertical" | "horizontal";
|
|
14
|
+
path?: string;
|
|
15
|
+
resize?: "defer" | "responsive";
|
|
16
|
+
resizeable?: boolean;
|
|
17
|
+
tearOut?: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ListItemProps } from "@heswell/salt-lab";
|
|
2
|
+
import { HTMLAttributes, ReactElement } from "react";
|
|
3
|
+
import "./Palette.css";
|
|
4
|
+
export interface PaletteItemProps extends ListItemProps {
|
|
5
|
+
children: ReactElement;
|
|
6
|
+
closeable?: boolean;
|
|
7
|
+
header?: boolean;
|
|
8
|
+
idx?: number;
|
|
9
|
+
resize?: "defer";
|
|
10
|
+
resizeable?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const PaletteItem: import("react").MemoExoticComponent<({ className, children: component, idx, resizeable, header, closeable, ...props }: PaletteItemProps) => JSX.Element>;
|
|
13
|
+
export interface PaletteProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
|
14
|
+
children: ReactElement[];
|
|
15
|
+
orientation: "horizontal" | "vertical";
|
|
16
|
+
selection?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const Palette: ({ children, className, orientation, ...props }: PaletteProps) => JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ListItemProps, ListProps } from "@heswell/salt-lab";
|
|
2
|
+
import { ReactElement } from "react";
|
|
3
|
+
import "./PaletteSalt.css";
|
|
4
|
+
export interface PaletteListItemProps extends ListItemProps {
|
|
5
|
+
children: ReactElement;
|
|
6
|
+
ViewProps: {
|
|
7
|
+
header?: boolean;
|
|
8
|
+
closeable?: boolean;
|
|
9
|
+
resizeable?: boolean;
|
|
10
|
+
};
|
|
11
|
+
template: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const PaletteListItem: (props: PaletteListItemProps) => JSX.Element;
|
|
14
|
+
export declare const PaletteSalt: ({ className, ...props }: ListProps) => JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
import "./Placeholder.css";
|
|
3
|
+
export interface PlaceholderProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
closeable?: boolean;
|
|
5
|
+
flexFill?: boolean;
|
|
6
|
+
resizeable?: boolean;
|
|
7
|
+
shim?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const Placeholder: {
|
|
10
|
+
({ className, closeable, flexFill, resizeable, shim, ...props }: PlaceholderProps): JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FunctionComponent } from "react";
|
|
2
|
+
export declare type layoutComponentType = "component" | "container" | "view";
|
|
3
|
+
export interface ComponentWithId {
|
|
4
|
+
id: string;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
export declare const ComponentRegistry: {
|
|
8
|
+
[key: string]: FunctionComponent<ComponentWithId>;
|
|
9
|
+
};
|
|
10
|
+
export declare function isContainer(componentType: string): boolean;
|
|
11
|
+
export declare function isView(componentType: string): boolean;
|
|
12
|
+
export declare const isLayoutComponent: (type: string) => boolean;
|
|
13
|
+
export declare const isRegistered: (className: string) => boolean;
|
|
14
|
+
export declare function registerComponent(componentName: string, component: FunctionComponent<any>, type?: layoutComponentType): void;
|
|
File without changes
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BreakPointsProp } from "../flexbox/flexboxTypes";
|
|
2
|
+
export declare type BreakPointRamp = [string, number, number];
|
|
3
|
+
export declare const breakpointRamp: (breakpoints: BreakPointsProp) => BreakPointRamp[];
|
|
4
|
+
export declare const getBreakPoints: (themeName?: string) => BreakPointRamp[];
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function measureMinimumNodeSize(node: HTMLElement, dimension?: 'width' | 'height'): number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
import { BreakPointsProp } from "../flexbox/flexboxTypes";
|
|
3
|
+
export interface BreakpointsHookProps {
|
|
4
|
+
breakPoints?: BreakPointsProp;
|
|
5
|
+
smallerThan?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const useBreakpoints: ({ breakPoints: breakPointsProp, smallerThan }: BreakpointsHookProps, ref: RefObject<HTMLElement>) => string | boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export declare const WidthHeight: string[];
|
|
3
|
+
export declare const HeightOnly: string[];
|
|
4
|
+
export declare const WidthOnly: string[];
|
|
5
|
+
export declare type measurements<T = string | number> = {
|
|
6
|
+
height?: T;
|
|
7
|
+
scrollHeight?: T;
|
|
8
|
+
scrollWidth?: T;
|
|
9
|
+
width?: T;
|
|
10
|
+
};
|
|
11
|
+
export declare type ResizeHandler = (measurements: measurements<number>) => void;
|
|
12
|
+
export declare function useResizeObserver(ref: RefObject<Element | HTMLElement | null>, dimensions: string[], onResize: ResizeHandler, reportInitialSize?: boolean): void;
|