import * as React from "react"; import styled from "@emotion/styled"; import { Background } from "./Background.js"; import { Document } from "./Document.js"; import { Frame } from "./Frame.js"; import { Reel } from "./Reel.js"; import { Registry } from "./Registry.js"; import { Window } from "./Window.js"; import { Word } from "./Word.js"; import { toViewModel } from "./to-view-model.js"; import { from, to } from "./util.js"; import { LoadedCast } from "./load-cast.js"; import { Theme } from "./default-theme.js"; export interface SvgTermProps { cast: LoadedCast; theme: Theme; paddingX: number; paddingY: number; decorations: boolean; from?: number; to?: number; at?: number; cursor: boolean; } const StyledContainer = styled.g` font-family: ${(props: any) => props.fontFamily}; `; export const SvgTerm: React.FunctionComponent = props => { const bound = { from: props.from, to: props.to, at: props.at, cast: props.cast }; const data = toViewModel({ cast: props.cast, cursor: props.cursor, theme: props.theme, from: from(bound), to: to(bound) }); return ( frame.cursor.visible)} hasFrames={data.frames.length > 0} items={data.registry} theme={props.theme} /> {data.frames.map((frame: any, index: number) => { return ( {frame.cursor.visible && ( )} {frame.lines.map((line: any, index: number) => { if (typeof line.id === "number") { return ( ); } return line.words.map((word: any, wordIndex: number) => { return ( {word.children} ); }); })} ); })} ); };