import { forwardRef, useEffect, useId, useRef, useState } from 'react'; import { Col } from '../components/Col'; import { Rect } from '../components/Rect'; import { Text } from '../components/Text'; import { Row } from '../components/Row'; import { SVG } from '../components/SVG'; import { Align } from '../components/Align'; import { BBoxWithChildren, Measure, useBluefishLayout, withBluefish, withBluefishComponent, useBluefishContext, } from '../bluefish'; import { Ref } from '../components/Ref'; import { Group } from '../components/Group'; import { Line } from '../components/Line'; import { Arrow } from '../components/Arrow'; import { Space } from '../components/Space'; import { Connector } from '../components/Connector'; export type CharProps = { value: string; opId: string; deleted: boolean; marks: ('italic' | 'bold')[]; }; export const Char = forwardRef(({ value, marks, opId }: CharProps, ref: any) => { const tile = useRef(null); const leftHandle = useRef(null); const rightHandle = useRef(null); const letter = useRef(null); const opIdLabel = useRef(null); return ( // TODO: use x and y to position the group ); }); export type MarkOpProps = { action: string; markType: string; backgroundColor: string; borderColor: string; opId: string; start: { opId: string }; end: { opId: string }; }; export const MarkOp: React.FC = forwardRef( ({ action, markType, backgroundColor, borderColor, start, end, opId }, ref: any) => { const rectRef = useRef(null); const textRef = useRef(null); return ( ); }, ); export type PeritextProps = { chars: CharProps[]; markOps: MarkOpProps[]; }; export const Peritext: React.FC = ({ chars, markOps }) => { const charsRef = useRef(null); const markOpsRef = useRef(null); return ( {/* chars */} {chars.map((char) => ( ))} {/* markOps */} {markOps.map((markOp) => ( ))} {/* space markOps from chars */} {markOps.map((markOp) => ( ))} ); };