From 807fd400c6c5d9004ac7560be642eda3a025d3c0 Mon Sep 17 00:00:00 2001 From: Roman Bruckner Date: Thu, 14 May 2026 22:12:18 +0200 Subject: [PATCH 1/3] =?UTF-8?q?refactor(joint-react):=20drop=20Paper=20wid?= =?UTF-8?q?th/height=20props=20=E2=80=94=20CSS-only=20sizing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `` no longer accepts `width` / `height` props. These were a redundant way to set inline CSS on the host (`dia.Paper.setDimensions` writes `$el.css({ width, height })` at the end), conflicting with `style` / `className` on the same element. Now the host element is sized exclusively by CSS: - `useCreatePortalPaper` forces `width: undefined, height: undefined` into the `dia.Paper` constructor options so prototype defaults (800/600) are clobbered → `paper.getComputedSize()` falls back to `el.clientWidth/clientHeight`. - The dedicated `setDimensions` sync effect on prop change is gone. All Paper callsites migrated from `` to `` (stories, tests, demos, tutorials, the storybook decorator). Co-Authored-By: Claude Opus 4.7 (1M context) --- .../decorators/with-simple-data.tsx | 5 +-- .../components/paper/__tests__/paper.test.tsx | 2 +- .../src/components/paper/paper.tsx | 20 +-------- .../src/components/paper/paper.types.ts | 45 +++++-------------- .../__tests__/paper-element-item.test.tsx | 8 ++-- .../__tests__/paper-html-overlay.test.tsx | 8 +--- .../__tests__/use-create-features.test.tsx | 12 +++-- .../use-create-portal-paper.test.tsx | 32 ++++--------- .../src/hooks/__tests__/use-markup.test.tsx | 14 ++---- .../hooks/__tests__/use-measure-node.test.tsx | 10 ++--- .../hooks/__tests__/use-paper-events.test.tsx | 2 +- .../src/hooks/__tests__/use-paper.test.tsx | 2 +- .../src/hooks/use-create-portal-paper.tsx | 30 ++++--------- .../demos/automatic-layout-storage/code.tsx | 5 +-- .../src/stories/demos/collaboration/code.tsx | 5 +-- .../src/stories/demos/flowchart/code.tsx | 3 +- .../stories/demos/introduction-demo/code.tsx | 5 +-- .../demos/investment-calculator/code.tsx | 5 +-- .../src/stories/demos/link-arrows/code.tsx | 4 +- .../src/stories/demos/pulsing-port/code.tsx | 3 +- .../src/stories/demos/saasflow/code.tsx | 5 +-- .../src/stories/demos/user-flow/code.tsx | 5 +-- .../examples/markup-selectors-html/code.tsx | 4 +- .../examples/markup-selectors/code.tsx | 5 +-- .../src/stories/examples/stress/code.tsx | 2 +- .../examples/with-auto-layout/code.tsx | 3 +- .../examples/with-build-in-shapes/code.tsx | 2 +- .../src/stories/examples/with-card/code.tsx | 2 +- .../examples/with-cell-actions/code.tsx | 2 +- .../stories/examples/with-cell-json/code.tsx | 4 +- .../with-collapsible-container/code.tsx | 4 +- .../with-collapsible-subtrees/code.tsx | 4 +- .../stories/examples/with-containers/code.tsx | 4 +- .../stories/examples/with-css-theme/code.tsx | 4 +- .../code-with-create-links-classname.tsx | 2 +- .../code-with-create-links.tsx | 2 +- .../with-custom-link/code-with-dia-links.tsx | 2 +- .../examples/with-custom-mapper/code.tsx | 4 +- .../examples/with-data-defaults/code.tsx | 4 +- .../examples/with-default-element/code.tsx | 3 +- .../examples/with-default-link/code.tsx | 3 +- .../with-dynamic-status-icons/code.tsx | 4 +- .../examples/with-element-controls/code.tsx | 5 +-- .../examples/with-element-defaults/code.tsx | 2 +- .../with-element-ports-groups/code.tsx | 3 +- .../with-element-ports-native/code.tsx | 4 +- .../examples/with-element-ports/code.tsx | 3 +- .../with-fixed-connection-points/code.tsx | 5 +-- .../examples/with-graph-neighbors/code.tsx | 5 +-- .../examples/with-highlighter/code.tsx | 3 +- .../examples/with-jointjs-api/code.tsx | 2 +- .../src/stories/examples/with-layers/code.tsx | 4 +- .../examples/with-link-labels/code.tsx | 4 +- .../examples/with-link-markers-named/code.tsx | 3 +- .../examples/with-link-markers/code.tsx | 3 +- .../examples/with-link-routing/code.tsx | 3 +- .../stories/examples/with-link-tools/code.tsx | 3 +- .../stories/examples/with-list-node/code.tsx | 4 +- .../stories/examples/with-minimap/code.tsx | 6 +-- .../with-node-update/code-add-remove-node.tsx | 3 +- .../with-node-update/code-with-color.tsx | 2 +- .../with-node-update/code-with-svg.tsx | 2 +- .../examples/with-node-update/code.tsx | 2 +- .../examples/with-portal-selector/code.tsx | 8 +--- .../examples/with-proximity-link/code.tsx | 3 +- .../examples/with-render-link/code.tsx | 3 +- .../examples/with-resizable-node/code.tsx | 2 +- .../examples/with-rotable-node/code.tsx | 2 +- .../examples/with-shape-animations/code.tsx | 4 +- .../stories/examples/with-svg-node/code.tsx | 2 +- .../examples/with-tailwind-theme/code.tsx | 3 +- .../code-controlled-mode-jotai.tsx | 2 +- .../code-controlled-mode-peerjs.tsx | 2 +- .../code-controlled-mode-redux.tsx | 2 +- .../code-controlled-mode-reset.tsx | 2 +- .../code-controlled-mode-zustand.tsx | 2 +- .../step-by-step/code-controlled-mode.tsx | 2 +- .../step-by-step/code-html-renderer.tsx | 3 +- .../tutorials/step-by-step/code-html.tsx | 2 +- .../tutorials/step-by-step/code-svg.tsx | 2 +- .../utils/joint-jsx/jsx-to-markup.stories.tsx | 2 +- .../joint-react/src/utils/test-wrappers.tsx | 8 ++-- 82 files changed, 125 insertions(+), 296 deletions(-) diff --git a/packages/joint-react/.storybook/decorators/with-simple-data.tsx b/packages/joint-react/.storybook/decorators/with-simple-data.tsx index 5f8f2db505..86640b6427 100644 --- a/packages/joint-react/.storybook/decorators/with-simple-data.tsx +++ b/packages/joint-react/.storybook/decorators/with-simple-data.tsx @@ -84,8 +84,7 @@ export function RenderItemDecorator( return (
- - + {properties.children} diff --git a/packages/joint-react/src/components/paper/__tests__/paper.test.tsx b/packages/joint-react/src/components/paper/__tests__/paper.test.tsx index 25cf913866..566f058858 100644 --- a/packages/joint-react/src/components/paper/__tests__/paper.test.tsx +++ b/packages/joint-react/src/components/paper/__tests__/paper.test.tsx @@ -56,7 +56,7 @@ describe('Paper', () => { }); return ( - + ); } diff --git a/packages/joint-react/src/components/paper/paper.tsx b/packages/joint-react/src/components/paper/paper.tsx index d9fae05dbc..3fe32d3fc6 100644 --- a/packages/joint-react/src/components/paper/paper.tsx +++ b/packages/joint-react/src/components/paper/paper.tsx @@ -5,20 +5,6 @@ import { PaperStoreContext } from '../../context'; import { useCreatePortalPaper } from '../../hooks/use-create-portal-paper'; import type { PaperProps } from './paper.types'; -/** - * Resolves a CSS dimension value to a JointJS Paper dimension. - * @param dimension - The CSS width or height value. - * @returns The resolved dimension or undefined. - */ -function resolveStyleDimension( - dimension: React.CSSProperties['width'] | React.CSSProperties['height'] -): dia.Paper.Dimension | undefined { - if (dimension === undefined) { - return undefined; - } - return dimension; -} - /** * Internal Paper implementation used by forwarded `Paper` component. * @param props - Paper component props. @@ -29,17 +15,13 @@ function PaperBase( props: Readonly, forwardedRef: React.ForwardedRef ) { - const { className, style, children, width, height, paper: externalPaper } = props; - const resolvedWidth = width ?? resolveStyleDimension(style?.width); - const resolvedHeight = height ?? resolveStyleDimension(style?.height); + const { className, style, children, paper: externalPaper } = props; const paperHTMLElementRef = useRef(null); const reactId = useId(); const id = props.id ?? `paper-${reactId}`; const isExternalPaper = !!externalPaper; const { paperRef, paperStore, isReady, content } = useCreatePortalPaper({ ...props, - width: resolvedWidth, - height: resolvedHeight, elementRef: isExternalPaper ? undefined : paperHTMLElementRef, id, style, diff --git a/packages/joint-react/src/components/paper/paper.types.ts b/packages/joint-react/src/components/paper/paper.types.ts index bb61eb14ca..55d1d15af3 100644 --- a/packages/joint-react/src/components/paper/paper.types.ts +++ b/packages/joint-react/src/components/paper/paper.types.ts @@ -88,9 +88,11 @@ export interface PortalPaperOptions { /** Unique identifier used by joint-react to track the paper instance. */ readonly id?: string; - // ── Sizing & appearance ────────────────────────────────────────────────── - readonly width?: dia.Paper.Options['width']; - readonly height?: dia.Paper.Options['height']; + // ── Appearance ─────────────────────────────────────────────────────────── + // Note: sizing is intentionally NOT exposed. Paper is sized exclusively + // by host CSS (`className` / `style`); `paper.getComputedSize()` falls + // back to `el.clientWidth/clientHeight` when `options.width/height` are + // not numeric (see `dia.Paper.getComputedSize`). readonly drawGrid?: dia.Paper.Options['drawGrid']; readonly drawGridSize?: dia.Paper.Options['drawGridSize']; readonly gridSize?: dia.Paper.Options['gridSize']; @@ -213,30 +215,6 @@ export type RenderLink = (data: LinkData) => ReactNode; * @see https://docs.jointjs.com/api/dia/Paper */ export interface PaperProps extends PortalPaperOptions, PropsWithChildren { - /** - * Width of the paper host element. - * - * Precedence for width is: - * 1. `width` prop - * 2. `style.width` - * 3. CSS width from `className` - * - * When this prop is omitted, the Paper component falls back to `style.width`. - * If both are omitted, width is left unset so host CSS can size the paper. - */ - readonly width?: dia.Paper.Dimension; - /** - * Height of the paper host element. - * - * Precedence for height is: - * 1. `height` prop - * 2. `style.height` - * 3. CSS height from `className` - * - * When this prop is omitted, the Paper component falls back to `style.height`. - * If both are omitted, height is left unset so host CSS can size the paper. - */ - readonly height?: dia.Paper.Dimension; /** * A function that renders the element. * @@ -292,17 +270,14 @@ export interface PaperProps extends PortalPaperOptions, PropsWithChildren { // eslint-disable-next-line @typescript-eslint/no-explicit-any readonly renderLink?: RenderLink; /** - * Inline styles applied to the paper host element. - * - * For sizing, `style.width` and `style.height` are used only when the matching - * `width` / `height` props are not provided. + * Inline styles applied to the paper host element. Use `style.width` and + * `style.height` (or CSS via `className`) to size the paper — Paper does + * not expose dedicated width/height props. */ readonly style?: CSSProperties; /** - * CSS classes applied to the paper host element. - * - * Class-based sizing is lowest priority and is used only when the matching - * `width` / `height` prop and `style.width` / `style.height` are omitted. + * CSS classes applied to the paper host element. Combine with width / + * height rules to size the paper. */ readonly className?: string; /** diff --git a/packages/joint-react/src/components/paper/render-element/__tests__/paper-element-item.test.tsx b/packages/joint-react/src/components/paper/render-element/__tests__/paper-element-item.test.tsx index 9b17364a32..7a8c0612b8 100644 --- a/packages/joint-react/src/components/paper/render-element/__tests__/paper-element-item.test.tsx +++ b/packages/joint-react/src/components/paper/render-element/__tests__/paper-element-item.test.tsx @@ -39,7 +39,7 @@ describe('paper-element-item exports', () => { let capturedPaper: unknown = null; const { rerender, container } = render( - }> + }> { capturedGraph = graph; @@ -79,7 +79,7 @@ describe('paper-element-item exports', () => { let capturedPaper: unknown = null; const { rerender, container } = render( - }> + }> { capturedGraph = graph; @@ -117,7 +117,7 @@ describe('paper-element-item exports', () => { let capturedPaper: unknown = null; const { rerender, container } = render( - }> + }> { capturedGraph = graph; @@ -167,7 +167,7 @@ describe('paper-element-item exports', () => { let capturedPaper: unknown = null; const { rerender, container } = render( - }> + }> { capturedGraph = graph; diff --git a/packages/joint-react/src/components/paper/render-element/__tests__/paper-html-overlay.test.tsx b/packages/joint-react/src/components/paper/render-element/__tests__/paper-html-overlay.test.tsx index d3dff82e81..5b00373ef0 100644 --- a/packages/joint-react/src/components/paper/render-element/__tests__/paper-html-overlay.test.tsx +++ b/packages/joint-react/src/components/paper/render-element/__tests__/paper-html-overlay.test.tsx @@ -27,9 +27,7 @@ describe('Paper with useHTMLOverlay', () => { it('renders elements through the HTML overlay container with positioned wrappers', async () => { const { container } = render( - (
{label}
@@ -63,9 +61,7 @@ describe('Paper with useHTMLOverlay', () => { it('keeps the HTML overlay positioned correctly while paper is mounted', async () => { const { container } = render( - x} /> diff --git a/packages/joint-react/src/hooks/__tests__/use-create-features.test.tsx b/packages/joint-react/src/hooks/__tests__/use-create-features.test.tsx index 1c90986d76..71840c7289 100644 --- a/packages/joint-react/src/hooks/__tests__/use-create-features.test.tsx +++ b/packages/joint-react/src/hooks/__tests__/use-create-features.test.tsx @@ -29,7 +29,7 @@ describe('useCreateFeature — paper target lifecycle', () => { })); render( - +
paper-child
@@ -55,7 +55,7 @@ describe('useCreateFeature — paper target lifecycle', () => { })); const { unmount } = render( - +
cleanup-child
@@ -76,7 +76,7 @@ describe('useCreateFeature — paper target lifecycle', () => { })); render( - + { function App({ value }: Readonly<{ value: number }>) { return ( - + { render( -
deferred-child
diff --git a/packages/joint-react/src/hooks/__tests__/use-create-portal-paper.test.tsx b/packages/joint-react/src/hooks/__tests__/use-create-portal-paper.test.tsx index 430c4ebd32..4da8e87170 100644 --- a/packages/joint-react/src/hooks/__tests__/use-create-portal-paper.test.tsx +++ b/packages/joint-react/src/hooks/__tests__/use-create-portal-paper.test.tsx @@ -85,8 +85,6 @@ describe('useCreatePortalPaper — error and edge cases', () => { () => useCreatePortalPaper({ id: 'on-ready-paper', - width: 100, - height: 100, renderElement: () => , onReady, isExternalPaper: false, @@ -110,11 +108,9 @@ describe('Paper — defaultLink prop variants (lines 100–124)', () => { const paperRef = useRef(null); return ( <> - } defaultLink={ { @@ -150,11 +146,9 @@ describe('Paper — defaultLink prop variants (lines 100–124)', () => { const paperRef = useRef(null); return ( <> - } defaultLink={factory as never} /> @@ -186,11 +180,9 @@ describe('Paper — defaultLink prop variants (lines 100–124)', () => { const paperRef = useRef(null); return ( <> - } defaultLink={factory as never} /> @@ -216,11 +208,9 @@ describe('Paper — defaultLink prop variants (lines 100–124)', () => { const paperRef = useRef(null); return ( <> - } defaultLink={staticLink as unknown as Parameters[0]['defaultLink']} /> @@ -247,11 +237,9 @@ describe('Paper — defaultLink prop variants (lines 100–124)', () => { const paperRef = useRef(null); return ( <> - } defaultLink={factory as never} /> @@ -280,10 +268,8 @@ interface GridAppProps { function GridApp({ drawGrid, gridSize, transform }: Readonly) { return ( - } drawGrid={drawGrid} gridSize={gridSize} @@ -317,7 +303,7 @@ describe('Paper — defaultRenderElement fallback (line 174)', () => { it('renders cell.data.label inside a default HTML host when renderElement is omitted', async () => { const { container } = render( - + ); await waitFor(() => { @@ -345,10 +331,8 @@ describe('Paper — renderLink integration (LinkItem render, line 161)', () => { )); render( - } renderLink={renderLink} /> diff --git a/packages/joint-react/src/hooks/__tests__/use-markup.test.tsx b/packages/joint-react/src/hooks/__tests__/use-markup.test.tsx index 8689bc1c0f..7be95224d0 100644 --- a/packages/joint-react/src/hooks/__tests__/use-markup.test.tsx +++ b/packages/joint-react/src/hooks/__tests__/use-markup.test.tsx @@ -67,7 +67,7 @@ function renderInPaper(options?: Readonly) { )); return render( - + ); } @@ -160,10 +160,8 @@ describe('useMarkup', () => { cleanupUtilities = undefined; render( - @@ -178,10 +176,8 @@ describe('useMarkup', () => { reservedUtilities = undefined; render( - @@ -202,10 +198,8 @@ describe('useMarkup', () => { emptyCaptured = undefined; render( - diff --git a/packages/joint-react/src/hooks/__tests__/use-measure-node.test.tsx b/packages/joint-react/src/hooks/__tests__/use-measure-node.test.tsx index f69f6db587..bfb6823bbc 100644 --- a/packages/joint-react/src/hooks/__tests__/use-measure-node.test.tsx +++ b/packages/joint-react/src/hooks/__tests__/use-measure-node.test.tsx @@ -79,7 +79,7 @@ function renderProbe(visibility?: Visibility) { const function_ = pickRenderProbe(visibility); return render( - + ); } @@ -136,10 +136,8 @@ describe('useMeasureNode', () => { expect(() => render( - @@ -175,7 +173,7 @@ describe('useMeasureNode', () => { } render( - + ); await new Promise((resolve) => setTimeout(resolve, 50)); @@ -187,7 +185,7 @@ describe('useMeasureNode', () => { it('returns size record without registering when ref.current is null at mount', async () => { const { container } = render( - + ); await waitFor(() => { diff --git a/packages/joint-react/src/hooks/__tests__/use-paper-events.test.tsx b/packages/joint-react/src/hooks/__tests__/use-paper-events.test.tsx index a20e90aecb..ef60fb6278 100644 --- a/packages/joint-react/src/hooks/__tests__/use-paper-events.test.tsx +++ b/packages/joint-react/src/hooks/__tests__/use-paper-events.test.tsx @@ -129,7 +129,7 @@ describe('usePaperEvents (hook integration)', () => { } render( - + diff --git a/packages/joint-react/src/hooks/__tests__/use-paper.test.tsx b/packages/joint-react/src/hooks/__tests__/use-paper.test.tsx index 67fdd113ec..b3e0ec5316 100644 --- a/packages/joint-react/src/hooks/__tests__/use-paper.test.tsx +++ b/packages/joint-react/src/hooks/__tests__/use-paper.test.tsx @@ -70,7 +70,7 @@ describe('useResolvePaperId', () => { const paperRef = useRef(null); return ( <> - + ); 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 0036602e94..d21078ae1d 100644 --- a/packages/joint-react/src/hooks/use-create-portal-paper.tsx +++ b/packages/joint-react/src/hooks/use-create-portal-paper.tsx @@ -305,6 +305,13 @@ export function useCreatePortalPaper( ...paperOptions, id, el: hostElementForCreation, + // Force undefined so the prototype `width`/`height` (800/600) get + // clobbered — `paper.getComputedSize()` then falls back to + // `el.clientWidth/clientHeight`, i.e. the host CSS size. Features + // that need a finite sheet size (e.g. ) must set + // `paper.options.width/height` explicitly themselves. + width: undefined, + height: undefined, defaultLink: defaultLinkCallback, validateConnection: validateConnectionCallback, connectionStrategy: connectionStrategyCallback, @@ -358,13 +365,6 @@ export function useCreatePortalPaper( if (!paperStore) return; if (!paper) return; - // `width` and `height` are managed by `paper.setDimensions()` only — - // see the dedicated useEffect below. They must NOT go through - // `assignOptions` (that would write `paper.options.width` directly, - // bypassing the DOM update and tripping `setDimensions`'s early-exit - // guard the next time it's called). - const { width: _w, height: _h, ...paperOptionsWithoutDimensions } = paperOptions; - assignOptions(paper.options, { defaultLink: defaultLinkCallback, validateConnection: validateConnectionCallback, @@ -373,7 +373,7 @@ export function useCreatePortalPaper( validateUnembedding: validateUnembeddingCallback, cellVisibility: cellVisibilityCallback, interactive: interactiveValue, - ...paperOptionsWithoutDimensions, + ...paperOptions, ...linkRouting, ...escapeHatchOptions, }); @@ -405,20 +405,6 @@ export function useCreatePortalPaper( transform, ]); - // Sync paper dimensions when the `width` / `height` props on `` - // change. Going through `setDimensions` (rather than mutating - // `paper.options.width/height` directly via assignOptions) keeps DOM CSS - // in lockstep with `paper.options` — features like `` - // that mutate `paper.options.width` via `setDimensions(...)` later won't - // hit the early-exit guard because of a stale options value. - const paperWidthProp = paperOptions.width; - const paperHeightProp = paperOptions.height; - useEffect(() => { - if (!paper) return; - if (paperWidthProp === undefined && paperHeightProp === undefined) return; - paper.setDimensions(paperWidthProp, paperHeightProp); - }, [paper, paperWidthProp, paperHeightProp]); - const elements = useMemo(() => { if (!hasRenderElement) { return null; diff --git a/packages/joint-react/src/stories/demos/automatic-layout-storage/code.tsx b/packages/joint-react/src/stories/demos/automatic-layout-storage/code.tsx index 78c37e693e..224f03906c 100644 --- a/packages/joint-react/src/stories/demos/automatic-layout-storage/code.tsx +++ b/packages/joint-react/src/stories/demos/automatic-layout-storage/code.tsx @@ -487,11 +487,8 @@ function InnerShell({ onLoadFile }: Readonly) {
- - target.port === 'in'} renderElement={RenderAgentNode} - style={{ backgroundColor: theme.canvas }} /> - diff --git a/packages/joint-react/src/stories/demos/investment-calculator/code.tsx b/packages/joint-react/src/stories/demos/investment-calculator/code.tsx index 52b6946dc0..6774484d22 100644 --- a/packages/joint-react/src/stories/demos/investment-calculator/code.tsx +++ b/packages/joint-react/src/stories/demos/investment-calculator/code.tsx @@ -686,14 +686,11 @@ function Main() { }, [graph]); return ( - ); diff --git a/packages/joint-react/src/stories/demos/link-arrows/code.tsx b/packages/joint-react/src/stories/demos/link-arrows/code.tsx index 38da4e6160..c9cbc0e98c 100644 --- a/packages/joint-react/src/stories/demos/link-arrows/code.tsx +++ b/packages/joint-react/src/stories/demos/link-arrows/code.tsx @@ -497,12 +497,10 @@ function Main() { }); return ( - ); diff --git a/packages/joint-react/src/stories/demos/pulsing-port/code.tsx b/packages/joint-react/src/stories/demos/pulsing-port/code.tsx index 4f45895022..114081f733 100644 --- a/packages/joint-react/src/stories/demos/pulsing-port/code.tsx +++ b/packages/joint-react/src/stories/demos/pulsing-port/code.tsx @@ -125,12 +125,11 @@ function Main() { }); return ( - - - ); diff --git a/packages/joint-react/src/stories/examples/stress/code.tsx b/packages/joint-react/src/stories/examples/stress/code.tsx index aec3565022..d156e57051 100644 --- a/packages/joint-react/src/stories/examples/stress/code.tsx +++ b/packages/joint-react/src/stories/examples/stress/code.tsx @@ -82,7 +82,7 @@ function Main({ return (
- +
-
diff --git a/packages/joint-react/src/stories/examples/with-build-in-shapes/code.tsx b/packages/joint-react/src/stories/examples/with-build-in-shapes/code.tsx index 448846047f..84420305d7 100644 --- a/packages/joint-react/src/stories/examples/with-build-in-shapes/code.tsx +++ b/packages/joint-react/src/stories/examples/with-build-in-shapes/code.tsx @@ -210,7 +210,7 @@ const initialCells: ReadonlyArray - +
); } diff --git a/packages/joint-react/src/stories/examples/with-card/code.tsx b/packages/joint-react/src/stories/examples/with-card/code.tsx index 8420e5217a..421f8c4dd9 100644 --- a/packages/joint-react/src/stories/examples/with-card/code.tsx +++ b/packages/joint-react/src/stories/examples/with-card/code.tsx @@ -80,7 +80,7 @@ function CardRenderer(data: Readonly) { function Main() { const renderElement: RenderElement = useCallback((data) => , []); - return ; + return ; } export default function App() { diff --git a/packages/joint-react/src/stories/examples/with-cell-actions/code.tsx b/packages/joint-react/src/stories/examples/with-cell-actions/code.tsx index ef4e85d742..59bfbf5a2c 100644 --- a/packages/joint-react/src/stories/examples/with-cell-actions/code.tsx +++ b/packages/joint-react/src/stories/examples/with-cell-actions/code.tsx @@ -564,7 +564,7 @@ function Main() { return (
{/* Canvas */} - + {/* Control Panel - Glassmorphism Style */}
-
diff --git a/packages/joint-react/src/stories/examples/with-collapsible-container/code.tsx b/packages/joint-react/src/stories/examples/with-collapsible-container/code.tsx index a95c274020..6f71612449 100644 --- a/packages/joint-react/src/stories/examples/with-collapsible-container/code.tsx +++ b/packages/joint-react/src/stories/examples/with-collapsible-container/code.tsx @@ -437,13 +437,11 @@ function Main() { ); return ( - ); } diff --git a/packages/joint-react/src/stories/examples/with-collapsible-subtrees/code.tsx b/packages/joint-react/src/stories/examples/with-collapsible-subtrees/code.tsx index fde4226718..065fdeb2c7 100644 --- a/packages/joint-react/src/stories/examples/with-collapsible-subtrees/code.tsx +++ b/packages/joint-react/src/stories/examples/with-collapsible-subtrees/code.tsx @@ -754,16 +754,14 @@ function Main() { const renderElement = useCallback((data: FTAData) => RenderFTAElement(data), []); return ( - ); diff --git a/packages/joint-react/src/stories/examples/with-containers/code.tsx b/packages/joint-react/src/stories/examples/with-containers/code.tsx index 7d1ebd4d95..d497f6a487 100644 --- a/packages/joint-react/src/stories/examples/with-containers/code.tsx +++ b/packages/joint-react/src/stories/examples/with-containers/code.tsx @@ -101,8 +101,7 @@ function validateParentChildRelationship({ parent }: ValidateEmbeddingContext): function Main() { return ( - ); diff --git a/packages/joint-react/src/stories/examples/with-css-theme/code.tsx b/packages/joint-react/src/stories/examples/with-css-theme/code.tsx index c3e1202a78..d65f8800ba 100644 --- a/packages/joint-react/src/stories/examples/with-css-theme/code.tsx +++ b/packages/joint-react/src/stories/examples/with-css-theme/code.tsx @@ -163,10 +163,8 @@ function Diagram() {
- diff --git a/packages/joint-react/src/stories/examples/with-custom-link/code-with-create-links-classname.tsx b/packages/joint-react/src/stories/examples/with-custom-link/code-with-create-links-classname.tsx index 2bf9ec55ff..f779928a82 100644 --- a/packages/joint-react/src/stories/examples/with-custom-link/code-with-create-links-classname.tsx +++ b/packages/joint-react/src/stories/examples/with-custom-link/code-with-create-links-classname.tsx @@ -21,7 +21,7 @@ const initialCells: ReadonlyArray> = [ function Main() { return (
- +
); } diff --git a/packages/joint-react/src/stories/examples/with-custom-link/code-with-create-links.tsx b/packages/joint-react/src/stories/examples/with-custom-link/code-with-create-links.tsx index 47f0990c67..387556e761 100644 --- a/packages/joint-react/src/stories/examples/with-custom-link/code-with-create-links.tsx +++ b/packages/joint-react/src/stories/examples/with-custom-link/code-with-create-links.tsx @@ -27,7 +27,7 @@ const initialCells: ReadonlyArray> = [ function Main() { return (
- +
); } diff --git a/packages/joint-react/src/stories/examples/with-custom-link/code-with-dia-links.tsx b/packages/joint-react/src/stories/examples/with-custom-link/code-with-dia-links.tsx index ff8f9a1c9a..d6c5f65e72 100644 --- a/packages/joint-react/src/stories/examples/with-custom-link/code-with-dia-links.tsx +++ b/packages/joint-react/src/stories/examples/with-custom-link/code-with-dia-links.tsx @@ -68,7 +68,7 @@ const initialCells: ReadonlyArray> = [ function Main() { return (
- +
); } diff --git a/packages/joint-react/src/stories/examples/with-custom-mapper/code.tsx b/packages/joint-react/src/stories/examples/with-custom-mapper/code.tsx index aac29ca8fe..8e723338c2 100644 --- a/packages/joint-react/src/stories/examples/with-custom-mapper/code.tsx +++ b/packages/joint-react/src/stories/examples/with-custom-mapper/code.tsx @@ -102,12 +102,12 @@ function DataPanel() { // Main // ============================================================================ -const PAPER_STYLE = { flex: 1 }; +const PAPER_STYLE = { flex: 1, height: 400 }; function Main() { return (
- +
); diff --git a/packages/joint-react/src/stories/examples/with-data-defaults/code.tsx b/packages/joint-react/src/stories/examples/with-data-defaults/code.tsx index 9b92710f26..c2339b069a 100644 --- a/packages/joint-react/src/stories/examples/with-data-defaults/code.tsx +++ b/packages/joint-react/src/stories/examples/with-data-defaults/code.tsx @@ -161,11 +161,9 @@ function Diagram() { - diff --git a/packages/joint-react/src/stories/examples/with-default-element/code.tsx b/packages/joint-react/src/stories/examples/with-default-element/code.tsx index 26fd987a2c..362c1c3ff4 100644 --- a/packages/joint-react/src/stories/examples/with-default-element/code.tsx +++ b/packages/joint-react/src/stories/examples/with-default-element/code.tsx @@ -144,9 +144,8 @@ export default function App() {
- diff --git a/packages/joint-react/src/stories/examples/with-default-link/code.tsx b/packages/joint-react/src/stories/examples/with-default-link/code.tsx index f9f01f8111..a61b638773 100644 --- a/packages/joint-react/src/stories/examples/with-default-link/code.tsx +++ b/packages/joint-react/src/stories/examples/with-default-link/code.tsx @@ -65,10 +65,9 @@ function RenderElement({ label }: Readonly) { export default function App() { return ( - ); } diff --git a/packages/joint-react/src/stories/examples/with-element-controls/code.tsx b/packages/joint-react/src/stories/examples/with-element-controls/code.tsx index 3d324aef7a..0c3a18942a 100644 --- a/packages/joint-react/src/stories/examples/with-element-controls/code.tsx +++ b/packages/joint-react/src/stories/examples/with-element-controls/code.tsx @@ -745,13 +745,10 @@ function Main() { useNodesMeasuredEffect(paperId, handleElementsMeasured); return ( - ); diff --git a/packages/joint-react/src/stories/examples/with-element-defaults/code.tsx b/packages/joint-react/src/stories/examples/with-element-defaults/code.tsx index 87df9590c8..32a41ce300 100644 --- a/packages/joint-react/src/stories/examples/with-element-defaults/code.tsx +++ b/packages/joint-react/src/stories/examples/with-element-defaults/code.tsx @@ -165,7 +165,7 @@ function JSONViewer() { export default function App() { return ( - + ); diff --git a/packages/joint-react/src/stories/examples/with-element-ports-groups/code.tsx b/packages/joint-react/src/stories/examples/with-element-ports-groups/code.tsx index 5520dc2346..08f6a209fd 100644 --- a/packages/joint-react/src/stories/examples/with-element-ports-groups/code.tsx +++ b/packages/joint-react/src/stories/examples/with-element-ports-groups/code.tsx @@ -89,9 +89,8 @@ function RenderElement({ label }: Readonly) { export default function App() { return ( - diff --git a/packages/joint-react/src/stories/examples/with-element-ports-native/code.tsx b/packages/joint-react/src/stories/examples/with-element-ports-native/code.tsx index 6fa8ecb891..f51caa580d 100644 --- a/packages/joint-react/src/stories/examples/with-element-ports-native/code.tsx +++ b/packages/joint-react/src/stories/examples/with-element-ports-native/code.tsx @@ -203,12 +203,10 @@ function Main() { ); return ( - ); diff --git a/packages/joint-react/src/stories/examples/with-element-ports/code.tsx b/packages/joint-react/src/stories/examples/with-element-ports/code.tsx index db59dfdff9..613863c046 100644 --- a/packages/joint-react/src/stories/examples/with-element-ports/code.tsx +++ b/packages/joint-react/src/stories/examples/with-element-ports/code.tsx @@ -387,10 +387,9 @@ function Main() { return (
- ); diff --git a/packages/joint-react/src/stories/examples/with-highlighter/code.tsx b/packages/joint-react/src/stories/examples/with-highlighter/code.tsx index 9c993d7fd6..67e2495f07 100644 --- a/packages/joint-react/src/stories/examples/with-highlighter/code.tsx +++ b/packages/joint-react/src/stories/examples/with-highlighter/code.tsx @@ -111,11 +111,10 @@ function Main({ variant }: Readonly) { return (
-
diff --git a/packages/joint-react/src/stories/examples/with-jointjs-api/code.tsx b/packages/joint-react/src/stories/examples/with-jointjs-api/code.tsx index abd5c4004c..1d77692227 100644 --- a/packages/joint-react/src/stories/examples/with-jointjs-api/code.tsx +++ b/packages/joint-react/src/stories/examples/with-jointjs-api/code.tsx @@ -152,7 +152,7 @@ function Main() { const renderElement = (data: ElementData) => ; return ( - + ); } diff --git a/packages/joint-react/src/stories/examples/with-layers/code.tsx b/packages/joint-react/src/stories/examples/with-layers/code.tsx index ba81e4233c..d348ff67b2 100644 --- a/packages/joint-react/src/stories/examples/with-layers/code.tsx +++ b/packages/joint-react/src/stories/examples/with-layers/code.tsx @@ -159,16 +159,14 @@ function Main({ hiddenLayers, toggleLayer }: Readonly) { ))}
- { const cellLayer = model.layer(); return !cellLayer || !hiddenLayers.has(cellLayer); }} - style={PAPER_STYLE} drawGrid={false} />
diff --git a/packages/joint-react/src/stories/examples/with-link-labels/code.tsx b/packages/joint-react/src/stories/examples/with-link-labels/code.tsx index 31189e7324..56e456e80b 100644 --- a/packages/joint-react/src/stories/examples/with-link-labels/code.tsx +++ b/packages/joint-react/src/stories/examples/with-link-labels/code.tsx @@ -79,9 +79,7 @@ const initialCells: ReadonlyArray> = [ function Main() { return ( - diff --git a/packages/joint-react/src/stories/examples/with-link-markers-named/code.tsx b/packages/joint-react/src/stories/examples/with-link-markers-named/code.tsx index 95c1177a5e..c2cc3c9ccc 100644 --- a/packages/joint-react/src/stories/examples/with-link-markers-named/code.tsx +++ b/packages/joint-react/src/stories/examples/with-link-markers-named/code.tsx @@ -51,10 +51,9 @@ const initialCells = buildCells(); export default function App() { return ( - diff --git a/packages/joint-react/src/stories/examples/with-link-markers/code.tsx b/packages/joint-react/src/stories/examples/with-link-markers/code.tsx index 9edbcc4d1d..0e0ac176da 100644 --- a/packages/joint-react/src/stories/examples/with-link-markers/code.tsx +++ b/packages/joint-react/src/stories/examples/with-link-markers/code.tsx @@ -143,10 +143,9 @@ export default function App() { - - -
); diff --git a/packages/joint-react/src/stories/examples/with-minimap/code.tsx b/packages/joint-react/src/stories/examples/with-minimap/code.tsx index b9304c7114..49b651ebfa 100644 --- a/packages/joint-react/src/stories/examples/with-minimap/code.tsx +++ b/packages/joint-react/src/stories/examples/with-minimap/code.tsx @@ -47,12 +47,11 @@ function MiniMap() { return (
-
@@ -75,10 +74,9 @@ function Main() { ); return (
- diff --git a/packages/joint-react/src/stories/examples/with-node-update/code-add-remove-node.tsx b/packages/joint-react/src/stories/examples/with-node-update/code-add-remove-node.tsx index f97ee96407..e2d3134f36 100644 --- a/packages/joint-react/src/stories/examples/with-node-update/code-add-remove-node.tsx +++ b/packages/joint-react/src/stories/examples/with-node-update/code-add-remove-node.tsx @@ -106,11 +106,10 @@ function Main() { >((cells) => cells.filter((cell) => isElement(cell)) as ReadonlyArray>); return (
-
diff --git a/packages/joint-react/src/stories/examples/with-node-update/code-with-color.tsx b/packages/joint-react/src/stories/examples/with-node-update/code-with-color.tsx index 6fab861462..9e497b519a 100644 --- a/packages/joint-react/src/stories/examples/with-node-update/code-with-color.tsx +++ b/packages/joint-react/src/stories/examples/with-node-update/code-with-color.tsx @@ -63,7 +63,7 @@ function RenderElement({ color }: Readonly) { function Main() { return (
- +
); } diff --git a/packages/joint-react/src/stories/examples/with-node-update/code-with-svg.tsx b/packages/joint-react/src/stories/examples/with-node-update/code-with-svg.tsx index 49994da7be..c22a760f70 100644 --- a/packages/joint-react/src/stories/examples/with-node-update/code-with-svg.tsx +++ b/packages/joint-react/src/stories/examples/with-node-update/code-with-svg.tsx @@ -51,7 +51,7 @@ function RenderElement() { function Main() { return (
- +
); } diff --git a/packages/joint-react/src/stories/examples/with-node-update/code.tsx b/packages/joint-react/src/stories/examples/with-node-update/code.tsx index 4f7add53a0..ae355d1ae8 100644 --- a/packages/joint-react/src/stories/examples/with-node-update/code.tsx +++ b/packages/joint-react/src/stories/examples/with-node-update/code.tsx @@ -71,7 +71,7 @@ function Main() { ); return (
- +
{elements.map((element) => ( ) { className="absolute bg-black bottom-6 right-6 border border-[#dde6ed] rounded-lg overflow-hidden" style={{ width: MINIMAP_WIDTH, height: MINIMAP_HEIGHT }} > -
@@ -306,12 +304,11 @@ function Main() { return (
- diff --git a/packages/joint-react/src/stories/examples/with-proximity-link/code.tsx b/packages/joint-react/src/stories/examples/with-proximity-link/code.tsx index c10ae36b6f..1b4a236fc7 100644 --- a/packages/joint-react/src/stories/examples/with-proximity-link/code.tsx +++ b/packages/joint-react/src/stories/examples/with-proximity-link/code.tsx @@ -102,9 +102,8 @@ function ResizableNode() { function Main() { return (
- diff --git a/packages/joint-react/src/stories/examples/with-render-link/code.tsx b/packages/joint-react/src/stories/examples/with-render-link/code.tsx index b2d6325e91..8f029eb15a 100644 --- a/packages/joint-react/src/stories/examples/with-render-link/code.tsx +++ b/packages/joint-react/src/stories/examples/with-render-link/code.tsx @@ -77,9 +77,8 @@ function Main({ useLinkModels }: Readonly<{ useLinkModels: boolean }>) { return (
-
diff --git a/packages/joint-react/src/stories/examples/with-resizable-node/code.tsx b/packages/joint-react/src/stories/examples/with-resizable-node/code.tsx index ef9d2ad754..a748067097 100644 --- a/packages/joint-react/src/stories/examples/with-resizable-node/code.tsx +++ b/packages/joint-react/src/stories/examples/with-resizable-node/code.tsx @@ -83,7 +83,7 @@ function ResizableNode() { function Main() { return (
- +
); } diff --git a/packages/joint-react/src/stories/examples/with-rotable-node/code.tsx b/packages/joint-react/src/stories/examples/with-rotable-node/code.tsx index 107b04fa6a..a64e1b5b89 100644 --- a/packages/joint-react/src/stories/examples/with-rotable-node/code.tsx +++ b/packages/joint-react/src/stories/examples/with-rotable-node/code.tsx @@ -104,7 +104,7 @@ function Main() { return (
- +
angle {elementRotation.map((rotation, index) => ( diff --git a/packages/joint-react/src/stories/examples/with-shape-animations/code.tsx b/packages/joint-react/src/stories/examples/with-shape-animations/code.tsx index c93af41b54..bad413698e 100644 --- a/packages/joint-react/src/stories/examples/with-shape-animations/code.tsx +++ b/packages/joint-react/src/stories/examples/with-shape-animations/code.tsx @@ -420,9 +420,7 @@ function PowerControl() { function Main() { return (
- - +
- DEFAULT_LINK} /> diff --git a/packages/joint-react/src/stories/tutorials/step-by-step/code-controlled-mode-jotai.tsx b/packages/joint-react/src/stories/tutorials/step-by-step/code-controlled-mode-jotai.tsx index 229c4504af..7f7f6328b2 100644 --- a/packages/joint-react/src/stories/tutorials/step-by-step/code-controlled-mode-jotai.tsx +++ b/packages/joint-react/src/stories/tutorials/step-by-step/code-controlled-mode-jotai.tsx @@ -111,7 +111,7 @@ function PaperApp() { return (
- + {/* Dark-themed controls */}
- +
); diff --git a/packages/joint-react/src/stories/tutorials/step-by-step/code-controlled-mode-zustand.tsx b/packages/joint-react/src/stories/tutorials/step-by-step/code-controlled-mode-zustand.tsx index 780ccf5692..43d3a2848a 100644 --- a/packages/joint-react/src/stories/tutorials/step-by-step/code-controlled-mode-zustand.tsx +++ b/packages/joint-react/src/stories/tutorials/step-by-step/code-controlled-mode-zustand.tsx @@ -166,7 +166,7 @@ function PaperApp() { return (
- + {/* Dark-themed controls */}