/* eslint-disable react-perf/jsx-no-new-object-as-prop */ /* eslint-disable react-perf/jsx-no-new-function-as-prop */ import { createElements, createLinks, GraphProvider, MeasuredNode, Paper, useCellId, useElements, useGraph, useUpdateElement, type InferElement, } from '@joint/react'; import '../index.css'; import { PAPER_CLASSNAME, PRIMARY } from 'storybook-config/theme'; const initialElements = createElements([ { id: '1', label: 'Node 1', color: '#ffffff', x: 40, y: 70 }, { id: '2', label: 'Node 2', color: '#ffffff', x: 170, y: 120 }, { id: '3', label: 'Node 2', color: '#ffffff', x: 30, y: 180 }, ]); const initialEdges = createLinks([ { id: 'e1-1', source: '1', target: '2', attrs: { line: { stroke: PRIMARY, }, }, }, ]); type BaseElementWithData = InferElement; function ElementInput({ id, label }: BaseElementWithData) { const setLabel = useUpdateElement(id, 'label'); return ( setLabel(event.target.value)} className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" /> ); } function RenderElement({ label, width, height }: BaseElementWithData) { const graph = useGraph(); const id = useCellId(); return (
{label}
); } function Main() { const elements = useElements(); return (
{elements.map((item) => { return ; })}
); } export default function App() { return (
); }