import * as React from "react"; import { pathOf, type Flat, type KeyMark, type LegendKey, type LineTone, type SolidPaths, type Tone } from "../iso-kit"; import { Stage } from "./live"; interface SolidProps { paths: SolidPaths; tone?: Tone; crease?: Tone | "none"; halo?: boolean; lit?: boolean; flat?: boolean; className?: string; inner?: React.ReactNode; children?: React.ReactNode; } export function Solid({ paths, tone = "hi", crease = "faint", halo = false, lit = false, flat = false, className, inner, children }: SolidProps) { return ( {halo ? : null} {flat ? null : paths.shades.map((d, shade) => (d ? : null))} {flat ? null : } {crease === "none" || !paths.crease ? null : } {crease === "none" || !paths.bevel ? null : } {inner} {children} ); } interface LineProps { d: string; tone?: LineTone; dotted?: boolean; dashed?: boolean; flow?: boolean; className?: string; free?: boolean | "start" | "end"; } export function Line({ d, tone = "lo", dotted = false, dashed = false, flow = false, className, free }: LineProps) { if (!d) return null; return ( ); } interface WireProps { from: Flat; to: Flat; via?: Flat[]; tone?: LineTone; dotted?: boolean; dashed?: boolean; flow?: boolean; ends?: "both" | "from" | "to" | "none"; size?: number; } const tenth = (value: number) => Math.round(value * 10) / 10; export function Wire({ from, to, via = [], tone = "lo", dotted = false, dashed = false, flow = false, ends = "both", size = 1.2 }: WireProps) { return ( {ends === "both" || ends === "from" ? : null} {ends === "both" || ends === "to" ? : null} ); } export function Dots({ points, size = 0.5, tone = "mid", pulse = false }: { points: Array; size?: number; tone?: Tone; pulse?: boolean }) { return ( {points.map(([x, y, alpha], index) => ( ))} ); } export function FaceText({ transform, children, size = 3, tone = "mid", anchor = "start", }: { transform: string; children: React.ReactNode; size?: number; tone?: Tone; anchor?: "start" | "middle" | "end"; }) { return ( {children} ); } interface IsoFigureProps { width: number; height: number; label: string; className?: string; children: React.ReactNode; } export function IsoFigure({ width, height, label, className, children }: IsoFigureProps) { return ( {children} ); } function Swatch({ mark }: { mark: KeyMark }) { if (mark === "raised" || mark === "flat" || mark === "lit") { return ( {mark === "flat" ? null : } ); } return ( ); } interface PlateProps { fig: string; title?: string; hint?: React.ReactNode; readout?: React.ReactNode; keys?: LegendKey[]; caption?: React.ReactNode; children: React.ReactNode; } export function Plate({ fig, title, hint, readout, keys = [], caption, children }: PlateProps) { return ( {fig} {title ? ( {title} ) : null} {hint ? ( {hint} ) : null} {readout} {children} {keys.length || caption ? ( {keys.length ? ( {keys.map((key) => ( {key.label} ))} ) : null} {caption ? {caption} : null} ) : null} ); }