import type { dia } from '@joint/core'; import type { GraphLink } from '../../types/link-types'; import { type Store } from '../../data/create-store'; import type { GraphElement } from '../../types/element-types'; export interface GraphProps { /** * Graph instance to use. If not provided, a new graph instance will be created. * @see https://docs.jointjs.com/api/dia/Graph * @default new dia.Graph({}, { cellNamespace: shapes }) */ readonly graph?: dia.Graph; /** * Children to render. */ readonly children?: React.ReactNode; /** * Namespace for cell models. * It's loaded just once, so it cannot be used as React state. * When added new shape, it will not remove existing ones, it will just add new ones. * So `{ ...shapes, ReactElement }` elements are still available. * @default `{ ...shapes, ReactElement }` * @see https://docs.jointjs.com/api/shapes */ readonly cellNamespace?: unknown; /** * Custom cell model to use. * It's loaded just once, so it cannot be used as React state. * @see https://docs.jointjs.com/api/dia/Cell */ readonly cellModel?: typeof dia.Cell; /** * Initial elements to be added to graph * It's loaded just once, so it cannot be used as React state. */ readonly initialElements?: Array; /** * Initial links to be added to graph * It's loaded just once, so it cannot be used as React state. */ readonly initialLinks?: Array; /** * Store is build around graph, it handles react updates and states, it can be created separately and passed to the provider via `createStore` function. * @see `createStore` */ readonly store?: Store; } /** * * GraphProvider component creates a graph instance and provide `dia.graph` to it's children. * It relies on @see useCreateGraphStore hook to create the graph instance. * * Without this provider, the library will not work. * @param props - {GraphProvider} props * @returns GraphProvider component * @example * Using provider: * ```tsx * import { GraphProvider } from '@joint/react' * * function App() { * return ( * * * * ) * ``` * @example * Using provider with default elements and links: * ```tsx * import { GraphProvider } from '@joint/react' * * function App() { * return ( * * * * ) * ``` * @group Components */ export declare function GraphProvider(props: Readonly): import("react/jsx-runtime").JSX.Element | null;