/** @jsxImportSource @atom.io/spa */ import type { SpaElement } from "@atom.io/spa" import { EditorIcon } from "./EditorIcon.tsx" import type { RecordedEvent } from "./history-event.ts" import { historyCollectionChanges } from "./history-value.ts" import { historyValuePair } from "./history-value-pair.ts" import css from "./HistoryWrite.module.css" import { OutcomeCollectionChange } from "./OutcomeCollectionChange.tsx" import { OutcomeValue } from "./OutcomeValue.tsx" import { OutcomeValuePair } from "./OutcomeValuePair.tsx" import type { EditorTools } from "./store.ts" export function HistoryWrite(props: { tools: EditorTools eventId: string event: Extract showName: boolean }): SpaElement { const { token, update } = props.event const { oldValue, newValue } = update const collection = historyCollectionChanges(oldValue, newValue) const pair = collection ? undefined : historyValuePair(oldValue, newValue) return ( {collection ? ( ) : pair ? ( ) : (

{props.showName && {token.key}}

)}
) }