-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUiEditorContext.d.ts
20 lines (19 loc) · 1.2 KB
/
UiEditorContext.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { IObservable } from 'react-observing';
import { TComponent, TDropFunctionProps, TElement, TElementTypesDefault, TStyle } from './types';
export type TValueParseFunction<D = any> = (value: any, ownerName: string, type: 'attribute' | 'textContent' | 'style', element: TElement<TElementTypesDefault, D>) => any;
export interface IUiEditorContextProps<D = any> {
styles: IObservable<TStyle[]>;
value: IObservable<TElement[]>;
components: IObservable<TComponent[]>;
onExpressionToValue: TValueParseFunction<D>;
onValueToExpression: TValueParseFunction<D>;
onDragEnd: () => void;
onDragStart: () => void;
onKeyDown: (event: KeyboardEvent) => void;
onDrop: (props: TDropFunctionProps<D>) => void;
onRemove: (element: TElement<TElementTypesDefault, D>) => void;
onDuplicate: (element: TElement<TElementTypesDefault, D>) => void;
onAddSlotContent: (element: TElement<'slot', D>, referenceComponent: TElement<'component', D>) => void;
}
export declare function UiEditorContextProvider({ children, ...props }: React.PropsWithChildren<IUiEditorContextProps<any>>): import("react/jsx-runtime").JSX.Element;
export declare const useUiEditorContext: () => IUiEditorContextProps<any>;