diff --git a/packages/joint-react/src/components/paper/paper.types.ts b/packages/joint-react/src/components/paper/paper.types.ts index 00f8866ef0..7947d6db7f 100644 --- a/packages/joint-react/src/components/paper/paper.types.ts +++ b/packages/joint-react/src/components/paper/paper.types.ts @@ -44,13 +44,16 @@ export type DefaultLink = | ((context: DefaultLinkParams) => dia.Link | Partial) | Partial; +/** Raw `dia.Paper.Options` passthrough — the type of the `options` escape-hatch prop. */ +export type PaperOptions = dia.Paper.Options; + /** * Officially supported Paper options. Pass-through props inherit their exact * native types via indexed access (`dia.Paper.Options['name']`), so any * type-level change in JointJS propagates automatically. Anything not listed * here is reachable via the `options` escape hatch, never implicitly exposed. */ -export interface PortalPaperOptions { +export interface PaperSupportedOptions { // ── Wrapped (structured) ───────────────────────────────────────────────── /** @@ -186,7 +189,7 @@ export interface PortalPaperOptions { * (`async`, `sorting`, `viewManagement`, `frozen`, `autoFreeze`) — the * portal rendering depends on their set values. */ - readonly options?: dia.Paper.Options; + readonly options?: PaperOptions; } /** @@ -237,7 +240,7 @@ export type RenderLink = (data: LinkData) => ReactNode; * use the `usePaperEvents` hook. * @see https://docs.jointjs.com/api/dia/Paper */ -export interface PaperProps extends PortalPaperOptions, PropsWithChildren, PaperEventHandlers { +export interface PaperProps extends PaperSupportedOptions, PropsWithChildren, PaperEventHandlers { /** * A function that renders the element. * diff --git a/packages/joint-react/src/hooks/use-create-portal-paper.tsx b/packages/joint-react/src/hooks/use-create-portal-paper.tsx index c0e9a2b618..9aff129efc 100644 --- a/packages/joint-react/src/hooks/use-create-portal-paper.tsx +++ b/packages/joint-react/src/hooks/use-create-portal-paper.tsx @@ -21,7 +21,7 @@ import { useCallback, useSyncExternalStore } from 'react'; import type { LinkRecord } from '../types/cell.types'; import type { PaperStore } from '../store'; import { ReactPaper } from '../mvc/react-paper'; -import type { PaperProps, PortalPaperOptions, RenderLink } from '../components/paper/paper.types'; +import type { DefaultLink, PaperProps, RenderLink } from '../components/paper/paper.types'; import { HTMLBox } from '../components/html-box'; import { mapLinkToAttributes } from '../state/data-mapping'; @@ -101,7 +101,7 @@ function getLinkModelConstructor(graph: dia.Graph): LinkModelConstructor { * into JointJS link model instances. * @param defaultLink */ -function createDefaultLinkCallback(defaultLink: PortalPaperOptions['defaultLink']) { +function createDefaultLinkCallback(defaultLink: DefaultLink | undefined) { // Guard for JS callers (TS already forbids it): a raw `dia.Link` instance // would force defensive `.clone()` on every connection and silently couple // every created link to one mutable model. Require a factory instead. diff --git a/packages/joint-react/src/index.ts b/packages/joint-react/src/index.ts index 465e939589..02f52d1b67 100644 --- a/packages/joint-react/src/index.ts +++ b/packages/joint-react/src/index.ts @@ -18,6 +18,7 @@ export type { IncrementalCellsChange } from './store/graph-projection'; export { Paper } from './components/paper/paper'; export type { PaperProps, + PaperOptions, PaperTransform, RenderElement, RenderLink,