UNPKG

@wener/ui

Version:

35 lines (34 loc) 1.27 kB
import React from 'react'; import { MenuSpec } from './types'; import { LayoutFrameState } from './state'; import type { MenuProps } from 'antd/lib/menu'; export interface LayoutFrameInstance { readonly name: any; subscribe(consumer: (state: LayoutFrameState) => void): () => void; update(update: (state: LayoutFrameState) => void): any; getState(): LayoutFrameState; dispose(): void; } export interface LayoutFrameOptions { name?: string; menus: MenuSpec[]; link?: ({ href }: { href: any; }) => React.ReactNode; menuProps?: Partial<MenuProps>; } interface TypedUseSelectorHook<TState> { <TSelected>(selector: (state: TState) => TSelected, equalityFn?: (left: TSelected, right: TSelected) => boolean): TSelected; } export declare const useLayoutFrameSelector: TypedUseSelectorHook<LayoutFrameState>; export declare function useLayoutFrameOptions(): LayoutFrameOptions; export declare const LayoutFrameProvider: React.FC<{ layout: LayoutFrameInstance; options: LayoutFrameOptions; }>; export declare function useLayoutFrame(options?: { layout?: LayoutFrameInstance; initialState?: Partial<LayoutFrameState> | (() => Partial<LayoutFrameState>); name?: string; }): LayoutFrameInstance; export {};