Repository Public
1"use client";2/**3 * Layers, properties and steps panels. Together they are the keyboard / screen-reader path of the editor: everything4 * the canvas does with a pointer (select, move, connect, reorder, group, highlight a step) can be done from here.5 */6import { useState } from "react";7import { ICONS, NODE_SHAPES, TONES, type Locale, type Tone } from "@/schema";8import { fill } from "@/i18n/dict";9import { IconGlyph } from "@/renderer/icons";10import {11 EMPTY_SELECTION, LIMITS, addLegendEntry, addStep, align, assignGroup, connectIssue, createGroup, deleteGroup, distribute, groupMembers, moveStep,12 removeLegendEntry, removeStep, reorder, resetLayout, reverseEdge, selectAll, selectionSize, setLocked, setNodePosition, stepsOf, toggleSelect, toggleStepItem,13 updateDiagram, updateEdge, updateGroup, updateLegendEntry, updateNode, updateStep,14 type AlignMode, type Boxes, type DEdge, type Diagram, type DNode, type Selection,15} from "./ops";16import { ARROW_LABEL, DIRECTION_LABEL, KIND_LABEL, LEGEND_SHAPE_LABEL, PORT_LABEL, ROUTING_LABEL, SHAPE_LABEL, STYLE_LABEL, TONE_LABEL, type Strings } from "./strings";17import { CommitInput, CommitTextarea, FieldLabel, IconButton, Section, SelectField, TextButton } from "./ui";1819export type Apply = (op: (block: Diagram) => Diagram) => boolean;2021const options = <K extends string>(labels: Record<K, string>, keys: readonly K[]): { value: K; label: string }[] => keys.map((k) => ({ value: k, label: labels[k] }));22const PORTS = ["auto", "top", "right", "bottom", "left"] as const;23const STYLES = ["solid", "dashed", "dotted"] as const;24const ARROWS = ["end", "both", "none"] as const;25const KINDS = ["flow", "architecture", "tree", "graph"] as const;26const DIRECTIONS = ["TB", "LR"] as const;27const ROUTINGS = ["orthogonal", "curved", "straight"] as const;28const LEGEND_SHAPES = ["square", "circle", "line", "dashed", "arrow"] as const;29const SELECTED_ROW = { background: "var(--ui-accent-soft)" } as const;3031export const edgeName = (block: Diagram, e: DEdge): string => {32 const name = (id: string) => block.nodes.find((n) => n.id === id)?.label ?? id;33 return e.label ? `${e.label} (${name(e.from)} → ${name(e.to)})` : `${name(e.from)} → ${name(e.to)}`;34};3536// ── Layers ──────────────────────────────────────────────────────────────────────────────────────────3738export function LayersPanel({ t, block, selection, multi, onSelect, apply }: { t: Strings; block: Diagram; selection: Selection; multi: boolean; onSelect: (s: Selection) => void; apply: Apply }) {39 const [renaming, setRenaming] = useState<string | null>(null);40 const row = (kind: "nodes" | "edges", id: string, text: string, value: string, max: number, locked: boolean, index: number, count: number) => {41 const key = `${kind}:${id}`, selected = selection[kind].includes(id);42 return (43 <li key={key} className="flex items-center gap-0.5 rounded-lg" style={selected ? SELECTED_ROW : undefined}>44 {renaming === key ? (45 <CommitInput hideLabel autoFocus label={t.rename} value={value} maxLength={max} onDone={() => setRenaming(null)}46 onCommit={(v) => apply((b) => (kind === "nodes" ? updateNode(b, id, { label: v }) : updateEdge(b, id, { label: v })))} />47 ) : (48 <button type="button" className="min-h-11 min-w-0 flex-1 truncate rounded-lg px-2 text-left text-sm md:min-h-9" aria-pressed={selected}49 onClick={(e) => onSelect(toggleSelect(selection, kind, id, e.shiftKey || e.metaKey || multi))}>50 {text}{locked ? <span className="text-faint"> · {t.lockedMark}</span> : null}51 </button>52 )}53 {selected && renaming !== key ? (54 <>55 <IconButton glyph="pencil" label={`${t.rename} — ${text}`} onClick={() => setRenaming(key)} />56 <IconButton glyph="up" label={`${t.moveUp} — ${text}`} disabled={index === 0} onClick={() => apply((b) => reorder(b, kind, id, -1))} />57 <IconButton glyph="down" label={`${t.moveDown} — ${text}`} disabled={index === count - 1} onClick={() => apply((b) => reorder(b, kind, id, 1))} />58 </>59 ) : null}60 </li>61 );62 };63 return (64 <div className="flex min-h-0 flex-1 flex-col overflow-y-auto">65 <Section title={`${t.nodes} (${block.nodes.length}/${LIMITS.nodes})`}>66 <ul className="flex flex-col gap-0.5">{block.nodes.map((n, i) => row("nodes", n.id, n.label, n.label, LIMITS.label, n.locked === true, i, block.nodes.length))}</ul>67 </Section>68 <Section title={`${t.edges} (${block.edges.length}/${LIMITS.edges})`}>69 {block.edges.length === 0 ? <p className="text-sm text-muted">{t.noEdges}</p> : (70 <ul className="flex flex-col gap-0.5">{block.edges.map((e, i) => row("edges", e.id, edgeName(block, e), e.label ?? "", LIMITS.edgeLabel, false, i, block.edges.length))}</ul>71 )}72 </Section>73 <div className="flex flex-wrap gap-2 px-3 py-3">74 <TextButton onClick={() => onSelect(selectAll(block))}>{t.selectAll}</TextButton>75 <TextButton onClick={() => onSelect(EMPTY_SELECTION)} disabled={selectionSize(selection) === 0}>{t.clearSelection}</TextButton>76 </div>77 </div>78 );79}8081// ── Properties ──────────────────────────────────────────────────────────────────────────────────────8283export interface PropertiesProps {84 t: Strings; locale: Locale; block: Diagram; boxes: Boxes; selection: Selection; apply: Apply;85 onDuplicate: () => void; onDelete: () => void; onConnect: (from: string, to: string) => void;86}8788function ToneSelect({ label, value, locale, onChange, hideLabel }: { label: string; value: Tone; locale: Locale; onChange: (tone: Tone) => void; hideLabel?: boolean }) {89 return <SelectField label={label} hideLabel={hideLabel} value={value} options={options(TONE_LABEL(locale), TONES)} onChange={onChange} />;90}9192function SelectionSection({ t, locale, block, boxes, selection, apply, onDuplicate, onDelete }: PropertiesProps) {93 const [groupLabel, setGroupLabel] = useState("");94 const [groupTone, setGroupTone] = useState<Tone>("neutral");95 const ids = selection.nodes;96 const nodes = block.nodes.filter((n) => ids.includes(n.id));97 const allLocked = nodes.length > 0 && nodes.every((n) => n.locked);98 const common = nodes.length > 0 && nodes.every((n) => n.group === nodes[0].group) ? nodes[0].group ?? "" : "";99 const aligns: [AlignMode, string][] = [["left", t.alignLeft], ["center", t.alignCenter], ["right", t.alignRight], ["top", t.alignTop], ["middle", t.alignMiddle], ["bottom", t.alignBottom]];100 return (101 <Section title={`${t.selection} — ${fill(t.selected, { n: selectionSize(selection) })}`}>102 <div className="flex flex-wrap gap-2">103 <TextButton onClick={onDuplicate} disabled={ids.length === 0 || block.nodes.length + ids.length > LIMITS.nodes}>{t.duplicate}</TextButton>104 <TextButton onClick={onDelete} danger>{t.delete}</TextButton>105 {ids.length > 0 ? <TextButton onClick={() => apply((b) => setLocked(b, ids, !allLocked))}>{allLocked ? t.unlock : t.lock}</TextButton> : null}106 {ids.length > 0 ? <TextButton onClick={() => apply((b) => resetLayout(b, ids))} disabled={!nodes.some((n) => n.x !== undefined && !n.locked)}>{t.autoPlace}</TextButton> : null}107 </div>108 {ids.length >= 2 ? (109 <div role="group" aria-label={t.align}>110 <p className="mb-1 text-sm text-muted">{t.align}</p>111 <div className="flex flex-wrap gap-2">{aligns.map(([mode, text]) => <TextButton key={mode} label={`${t.align} : ${text}`} onClick={() => apply((b) => align(b, ids, mode, boxes))}>{text}</TextButton>)}</div>112 </div>113 ) : null}114 {ids.length >= 3 ? (115 <div role="group" aria-label={t.distribute}>116 <p className="mb-1 text-sm text-muted">{t.distribute}</p>117 <div className="flex flex-wrap gap-2">118 <TextButton label={`${t.distribute} : ${t.distributeH}`} onClick={() => apply((b) => distribute(b, ids, "horizontal", boxes))}>{t.distributeH}</TextButton>119 <TextButton label={`${t.distribute} : ${t.distributeV}`} onClick={() => apply((b) => distribute(b, ids, "vertical", boxes))}>{t.distributeV}</TextButton>120 </div>121 </div>122 ) : null}123 {ids.length > 0 ? (124 <>125 <SelectField label={t.assignGroup} value={common} options={[{ value: "", label: `— ${t.none} —` }, ...block.groups.map((g) => ({ value: g.id, label: g.label || g.id }))]}126 onChange={(v) => apply((b) => assignGroup(b, ids, v === "" ? null : v))} />127 <div className="flex flex-wrap gap-2">128 <TextButton onClick={() => apply((b) => assignGroup(b, ids, null))} disabled={!nodes.some((n) => n.group)}>{t.ungroup}</TextButton>129 </div>130 <div className="grid grid-cols-[1fr_auto] items-end gap-2">131 <FieldLabel label={t.newGroup}>132 <input className="field" type="text" value={groupLabel} maxLength={LIMITS.groupLabel} placeholder={t.groupDefault} onChange={(e) => setGroupLabel(e.target.value)} />133 </FieldLabel>134 <ToneSelect label={t.tone} hideLabel value={groupTone} locale={locale} onChange={setGroupTone} />135 </div>136 <div>137 <TextButton disabled={block.groups.length >= LIMITS.groups}138 onClick={() => { if (apply((b) => createGroup(b, ids, groupLabel.trim() || `${t.groupDefault} ${b.groups.length + 1}`, groupTone))) setGroupLabel(""); }}>{t.createGroup}</TextButton>139 </div>140 </>141 ) : null}142 </Section>143 );144}145146function NodeSection({ t, locale, block, boxes, apply, onConnect, node }: PropertiesProps & { node: DNode }) {147 const [target, setTarget] = useState("");148 const box = boxes.get(node.id);149 const others = block.nodes.filter((n) => n.id !== node.id && !connectIssue(block, node.id, n.id));150 const chosen = others.some((n) => n.id === target) ? target : "";151 const setCoord = (axis: "x" | "y", raw: string) => {152 const text = raw.trim().replace(",", ".");153 if (text === "") { apply((b) => resetLayout(b, [node.id])); return; }154 const value = Number(text);155 if (Number.isFinite(value)) apply((b) => setNodePosition(b, node.id, { [axis]: value }, boxes));156 };157 return (158 <Section title={t.node}>159 <CommitInput label={t.label} value={node.label} maxLength={LIMITS.label} onCommit={(v) => apply((b) => updateNode(b, node.id, { label: v }))} />160 <CommitInput label={t.sublabel} value={node.sublabel ?? ""} maxLength={LIMITS.sublabel} onCommit={(v) => apply((b) => updateNode(b, node.id, { sublabel: v }))} />161 <div className="grid grid-cols-2 gap-2">162 <SelectField label={t.shape} value={node.shape} options={options(SHAPE_LABEL(locale), NODE_SHAPES)} onChange={(shape) => apply((b) => updateNode(b, node.id, { shape }))} />163 <ToneSelect label={t.tone} value={node.tone} locale={locale} onChange={(tone) => apply((b) => updateNode(b, node.id, { tone }))} />164 </div>165 <div className="grid grid-cols-[1fr_auto] items-end gap-2">166 <SelectField<string> label={t.icon} value={node.icon ?? ""} options={[{ value: "", label: `— ${t.noneF} —` }, ...ICONS.map((i) => ({ value: i as string, label: i }))]}167 onChange={(v) => apply((b) => updateNode(b, node.id, { icon: ICONS.find((i) => i === v) ?? null }))} />168 <span className="flex h-11 w-11 items-center justify-center rounded-lg border border-line text-muted" aria-hidden="true">{node.icon ? <IconGlyph name={node.icon} /> : null}</span>169 </div>170 <SelectField<string> label={t.group} value={node.group ?? ""} options={[{ value: "", label: `— ${t.none} —` }, ...block.groups.map((g) => ({ value: g.id, label: g.label || g.id }))]}171 onChange={(v) => apply((b) => updateNode(b, node.id, { group: v === "" ? null : v }))} />172 <label className="flex min-h-11 items-center gap-2 text-sm">173 <input type="checkbox" className="h-5 w-5" checked={node.locked === true} onChange={(e) => apply((b) => setLocked(b, [node.id], e.target.checked))} />{t.locked}174 </label>175 <div className="grid grid-cols-2 gap-2">176 <CommitInput key={`x${node.locked}`} label={`${t.position} X`} inputMode="decimal" value={node.x !== undefined ? String(node.x) : ""} maxLength={9} placeholder={box ? `${t.auto} (${box.x})` : t.auto} onCommit={(v) => setCoord("x", v)} />177 <CommitInput key={`y${node.locked}`} label={`${t.position} Y`} inputMode="decimal" value={node.y !== undefined ? String(node.y) : ""} maxLength={9} placeholder={box ? `${t.auto} (${box.y})` : t.auto} onCommit={(v) => setCoord("y", v)} />178 </div>179 <div className="grid grid-cols-[1fr_auto] items-end gap-2">180 <SelectField<string> label={t.connectTo} value={chosen} options={[{ value: "", label: t.chooseNode }, ...others.map((n) => ({ value: n.id, label: n.label }))]} onChange={setTarget} disabled={block.edges.length >= LIMITS.edges} />181 <button type="button" className="btn" disabled={chosen === ""} onClick={() => { onConnect(node.id, chosen); setTarget(""); }}>{t.connectGo}</button>182 </div>183 </Section>184 );185}186187function EdgeSection({ t, locale, block, apply, edge }: PropertiesProps & { edge: DEdge }) {188 const ports = options(PORT_LABEL(locale), PORTS);189 return (190 <Section title={t.edge}>191 <p className="text-sm text-muted">{edgeName(block, { ...edge, label: undefined })}</p>192 <CommitInput label={t.label} value={edge.label ?? ""} maxLength={LIMITS.edgeLabel} onCommit={(v) => apply((b) => updateEdge(b, edge.id, { label: v }))} />193 <div className="grid grid-cols-2 gap-2">194 <SelectField label={t.style} value={edge.style} options={options(STYLE_LABEL(locale), STYLES)} onChange={(style) => apply((b) => updateEdge(b, edge.id, { style }))} />195 <SelectField label={t.arrow} value={edge.arrow} options={options(ARROW_LABEL(locale), ARROWS)} onChange={(arrow) => apply((b) => updateEdge(b, edge.id, { arrow }))} />196 <SelectField label={t.fromPort} value={edge.fromPort} options={ports} onChange={(fromPort) => apply((b) => updateEdge(b, edge.id, { fromPort }))} />197 <SelectField label={t.toPort} value={edge.toPort} options={ports} onChange={(toPort) => apply((b) => updateEdge(b, edge.id, { toPort }))} />198 </div>199 <ToneSelect label={t.tone} value={edge.tone} locale={locale} onChange={(tone) => apply((b) => updateEdge(b, edge.id, { tone }))} />200 <div><TextButton onClick={() => apply((b) => reverseEdge(b, edge.id))}>{t.reverse}</TextButton></div>201 </Section>202 );203}204205function DiagramSection({ t, locale, block, apply }: PropertiesProps) {206 return (207 <>208 <Section title={t.diagram}>209 <CommitInput label={t.title} value={block.title ?? ""} maxLength={LIMITS.title} onCommit={(v) => apply((b) => updateDiagram(b, { title: v }))} />210 <CommitTextarea label={t.caption} value={block.caption ?? ""} maxLength={LIMITS.caption} rows={2} onCommit={(v) => apply((b) => updateDiagram(b, { caption: v }))} />211 <CommitTextarea label={t.alt} hint={t.altHint} value={block.alt ?? ""} maxLength={LIMITS.alt} rows={3} onCommit={(v) => apply((b) => updateDiagram(b, { alt: v }))} />212 <SelectField label={t.kind} value={block.kind} options={options(KIND_LABEL(locale), KINDS)} onChange={(kind) => apply((b) => updateDiagram(b, { kind }))} />213 <div className="grid grid-cols-2 gap-2">214 <SelectField label={t.direction} value={block.direction} options={options(DIRECTION_LABEL(locale), DIRECTIONS)} onChange={(direction) => apply((b) => updateDiagram(b, { direction }))} />215 <SelectField label={t.routing} value={block.routing} options={options(ROUTING_LABEL(locale), ROUTINGS)} onChange={(routing) => apply((b) => updateDiagram(b, { routing }))} />216 </div>217 <div><TextButton onClick={() => apply((b) => resetLayout(b))} disabled={!block.nodes.some((n) => n.x !== undefined && !n.locked)}>{t.autoPlaceAll}</TextButton></div>218 </Section>219 <Section title={`${t.groups} (${block.groups.length}/${LIMITS.groups})`}>220 {block.groups.length === 0 ? <p className="text-sm text-muted">{t.noGroups}</p> : block.groups.map((g) => (221 <div key={g.id} className="grid grid-cols-[1fr_auto_auto] items-center gap-2">222 <CommitInput hideLabel label={`${t.group} — ${t.label}`} value={g.label} maxLength={LIMITS.groupLabel} onCommit={(v) => apply((b) => updateGroup(b, g.id, { label: v }))} />223 <ToneSelect hideLabel label={`${t.group} — ${t.tone}`} value={g.tone} locale={locale} onChange={(tone) => apply((b) => updateGroup(b, g.id, { tone }))} />224 <IconButton glyph="trash" label={`${t.deleteGroup} — ${g.label} (${fill(t.members, { n: groupMembers(block, g.id) })})`} onClick={() => apply((b) => deleteGroup(b, g.id))} />225 </div>226 ))}227 </Section>228 <Section title={`${t.legend} (${block.legend.length}/${LIMITS.legend})`}>229 {block.legend.map((entry, i) => (230 <div key={i} className="grid grid-cols-[1fr_auto] items-center gap-2 border-b border-line pb-2 last:border-b-0">231 <CommitInput hideLabel label={`${t.legend} ${i + 1} — ${t.label}`} value={entry.label} maxLength={LIMITS.legendLabel} onCommit={(v) => apply((b) => updateLegendEntry(b, i, { label: v }))} />232 <IconButton glyph="trash" label={`${t.remove} — ${entry.label}`} onClick={() => apply((b) => removeLegendEntry(b, i))} />233 <div className="col-span-2 grid grid-cols-2 gap-2">234 <ToneSelect hideLabel label={`${t.legend} ${i + 1} — ${t.tone}`} value={entry.tone} locale={locale} onChange={(tone) => apply((b) => updateLegendEntry(b, i, { tone }))} />235 <SelectField hideLabel label={`${t.legend} ${i + 1} — ${t.legendShape}`} value={entry.shape} options={options(LEGEND_SHAPE_LABEL(locale), LEGEND_SHAPES)} onChange={(shape) => apply((b) => updateLegendEntry(b, i, { shape }))} />236 </div>237 </div>238 ))}239 <div><TextButton disabled={block.legend.length >= LIMITS.legend} onClick={() => apply((b) => addLegendEntry(b, `${t.legendDefault} ${b.legend.length + 1}`))}>{t.addLegend}</TextButton></div>240 </Section>241 </>242 );243}244245export function PropertiesPanel(props: PropertiesProps) {246 const { block, selection } = props;247 const node = selection.nodes.length === 1 && selection.edges.length === 0 ? block.nodes.find((n) => n.id === selection.nodes[0]) : undefined;248 const edge = selection.edges.length === 1 && selection.nodes.length === 0 ? block.edges.find((e) => e.id === selection.edges[0]) : undefined;249 return (250 <div className="flex min-h-0 flex-1 flex-col overflow-y-auto">251 {selectionSize(selection) > 0 ? <SelectionSection {...props} /> : null}252 {node ? <NodeSection key={node.id} {...props} node={node} /> : null}253 {edge ? <EdgeSection key={edge.id} {...props} edge={edge} /> : null}254 <DiagramSection {...props} />255 </div>256 );257}258259// ── Animation steps ─────────────────────────────────────────────────────────────────────────────────260261export interface StepsProps {262 t: Strings; block: Diagram; apply: Apply;263 /** Selected step: previewed on the canvas. */264 index: number | null; onIndex: (index: number | null) => void;265 /** Canvas in step mode: a click toggles a node or an edge in the selected step. */266 picking: boolean; onPicking: (on: boolean) => void;267}268269export function StepsPanel({ t, block, apply, index, onIndex, picking, onPicking }: StepsProps) {270 const steps = stepsOf(block);271 const current = index !== null ? steps[index] : undefined;272 const move = (i: number, delta: number) => { if (apply((b) => moveStep(b, i, delta))) onIndex(i + delta); };273 return (274 <div className="flex min-h-0 flex-1 flex-col overflow-y-auto">275 <Section title={`${t.steps} (${steps.length}/${LIMITS.steps})`}>276 {steps.length === 0 ? <p className="text-sm text-muted">{t.noSteps}</p> : (277 <ol className="flex flex-col gap-0.5">278 {steps.map((s, i) => (279 <li key={i} className="flex items-center gap-0.5 rounded-lg" style={i === index ? SELECTED_ROW : undefined}>280 <button type="button" className="min-h-11 min-w-0 flex-1 truncate rounded-lg px-2 text-left text-sm md:min-h-9" aria-pressed={i === index} onClick={() => onIndex(i === index ? null : i)}>281 <span className="text-faint">{i + 1}.</span> {s.title}282 </button>283 {i === index ? (284 <>285 <IconButton glyph="up" label={`${t.moveUp} — ${s.title}`} disabled={i === 0} onClick={() => move(i, -1)} />286 <IconButton glyph="down" label={`${t.moveDown} — ${s.title}`} disabled={i === steps.length - 1} onClick={() => move(i, 1)} />287 <IconButton glyph="trash" label={`${t.removeStep} — ${s.title}`} onClick={() => { if (apply((b) => removeStep(b, i))) { onIndex(null); onPicking(false); } }} />288 </>289 ) : null}290 </li>291 ))}292 </ol>293 )}294 {steps.length === 2 ? <p className="text-xs text-faint">{t.stepsMin}</p> : null}295 <div className="flex flex-wrap gap-2">296 <TextButton disabled={steps.length >= LIMITS.steps} onClick={() => { if (apply((b) => addStep(b, (n) => fill(t.stepDefault, { n })))) onIndex(steps.length === 0 ? 0 : steps.length); }}>{t.addStep}</TextButton>297 {index !== null ? <TextButton onClick={() => { onIndex(null); onPicking(false); }}>{t.stepPreviewOff}</TextButton> : null}298 </div>299 </Section>300 {current && index !== null ? (301 <Section key={index} title={fill(t.stepDefault, { n: index + 1 })}>302 <CommitInput label={t.stepTitle} value={current.title} maxLength={LIMITS.stepTitle} onCommit={(v) => apply((b) => updateStep(b, index, { title: v }))} />303 <CommitTextarea label={t.stepText} value={current.text ?? ""} maxLength={LIMITS.stepText} onCommit={(v) => apply((b) => updateStep(b, index, { text: v }))} />304 <div><TextButton pressed={picking} onClick={() => onPicking(!picking)}>{t.stepPick}</TextButton></div>305 {picking ? <p className="text-xs text-muted" role="status">{t.stepPickOn}</p> : null}306 <details>307 <summary className="min-h-11 cursor-pointer py-2 text-sm md:min-h-9">{fill(t.stepHighlights, { n: current.nodes.length + current.edges.length })}</summary>308 <fieldset className="flex flex-col">309 <legend className="eyebrow mb-1 mt-2">{t.nodes}</legend>310 {block.nodes.map((n) => (311 <label key={n.id} className="flex min-h-11 items-center gap-2 text-sm md:min-h-8">312 <input type="checkbox" className="h-5 w-5 shrink-0" checked={current.nodes.includes(n.id)} onChange={() => apply((b) => toggleStepItem(b, index, "nodes", n.id))} /><span className="truncate">{n.label}</span>313 </label>314 ))}315 </fieldset>316 {block.edges.length > 0 ? (317 <fieldset className="flex flex-col">318 <legend className="eyebrow mb-1 mt-2">{t.edges}</legend>319 {block.edges.map((e) => (320 <label key={e.id} className="flex min-h-11 items-center gap-2 text-sm md:min-h-8">321 <input type="checkbox" className="h-5 w-5 shrink-0" checked={current.edges.includes(e.id)} onChange={() => apply((b) => toggleStepItem(b, index, "edges", e.id))} /><span className="truncate">{edgeName(block, e)}</span>322 </label>323 ))}324 </fieldset>325 ) : null}326 </details>327 </Section>328 ) : null}329 </div>330 );331}332