/* eslint-disable react-perf/jsx-no-new-object-as-prop */ /* eslint-disable react-perf/jsx-no-new-function-as-prop */ import { createElements, createLinks, GraphProvider, Paper, useElements, useUpdateElement, type InferElement, } from '@joint/react'; import '../index.css'; import { LIGHT, PAPER_CLASSNAME, PRIMARY } from 'storybook-config/theme'; const initialElements = createElements([ { id: '1', color: PRIMARY, x: 100, y: 0, width: 130, height: 35 }, { id: '2', color: PRIMARY, x: 100, y: 200, width: 130, height: 35 }, ]); const initialEdges = createLinks([ { id: 'e1-2', source: '1', target: '2', attrs: { line: { stroke: LIGHT, }, }, }, ]); type BaseElementWithData = InferElement; function ElementInput({ id, color }: BaseElementWithData) { const setColor = useUpdateElement(id, 'color'); return ( setColor(event.target.value)} /> ); } function RenderElement({ color, width, height }: BaseElementWithData) { return ; } function Main() { const elements = useElements(); return (
{elements.map((item) => { return ; })}
); } export default function App() { return (
); }